diff options
Diffstat (limited to 'sysdeps/i386/rawmemchr.S')
-rw-r--r-- | sysdeps/i386/rawmemchr.S | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/sysdeps/i386/rawmemchr.S b/sysdeps/i386/rawmemchr.S index 89ba8d3..9042ca9 100644 --- a/sysdeps/i386/rawmemchr.S +++ b/sysdeps/i386/rawmemchr.S @@ -31,6 +31,7 @@ #include <sysdep.h> #include "asm-syntax.h" +#include "bp-sym.h" #include "bp-asm.h" #define PARMS LINKAGE+4 /* space for 1 saved reg */ @@ -39,7 +40,7 @@ #define CHR STR+PTR_SIZE .text -ENTRY (__rawmemchr) +ENTRY (BP_SYM (__rawmemchr)) ENTER /* Save callee-safe register used in this function. */ @@ -48,6 +49,7 @@ ENTRY (__rawmemchr) /* Load parameters into registers. */ movl STR(%esp), %eax movl CHR(%esp), %edx + CHECK_BOUNDS_LOW (%eax, STR(%esp)) /* At the moment %edx contains C. What we need for the algorithm is C in all bytes of the dword. Avoid @@ -213,9 +215,13 @@ L(8): testb %cl, %cl /* test first byte in dword */ /* No further test needed we we know it is one of the four bytes. */ -L(9): popl %edi /* pop saved register */ +L(9): + CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb) + RETURN_BOUNDED_POINTER (STR(%esp)) + popl %edi /* pop saved register */ LEAVE - ret -END (__rawmemchr) -weak_alias (__rawmemchr, rawmemchr) + RET_PTR +END (BP_SYM (__rawmemchr)) + +weak_alias (BP_SYM (__rawmemchr), BP_SYM (rawmemchr)) |