about summary refs log tree commit diff
path: root/sysdeps/i386/strspn.S
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/i386/strspn.S')
-rw-r--r--sysdeps/i386/strspn.S12
1 files changed, 7 insertions, 5 deletions
diff --git a/sysdeps/i386/strspn.S b/sysdeps/i386/strspn.S
index cfd11f0a9f..7d8c82bf95 100644
--- a/sysdeps/i386/strspn.S
+++ b/sysdeps/i386/strspn.S
@@ -23,6 +23,7 @@
 
 #include <sysdep.h>
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 #define PARMS	LINKAGE		/* no space for saved regs */
@@ -30,11 +31,12 @@
 #define SKIP	STR+PTR_SIZE
 
 	.text
-ENTRY (strspn)
+ENTRY (BP_SYM (strspn))
 	ENTER
 
 	movl STR(%esp), %edx
 	movl SKIP(%esp), %eax
+	CHECK_BOUNDS_LOW (%edx, STR(%esp))
 
 	/* First we create a table with flags for all possible characters.
 	   For the ASCII (7bit/8bit) or ISO-8859-X character sets which are
@@ -169,11 +171,11 @@ L(3):	addl $4, %eax		/* adjust pointer for full loop round */
 L(6):	incl %eax
 L(5):	incl %eax
 
-L(4):	subl %edx, %eax		/* we have to return the number of valid
+L(4):	addl $256, %esp		/* remove stopset */
+	CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb)
+	subl %edx, %eax		/* we have to return the number of valid
 				   characters, so compute distance to first
 				   non-valid character */
-	addl $256, %esp		/* remove stopset */
-
 	LEAVE
 	ret
-END (strspn)
+END (BP_SYM (strspn))