* libc/machine/aarch64/memchr.S: Add check for zero-sized buffer.
This commit is contained in:
		| @@ -1,3 +1,7 @@ | |||||||
|  | 2014-08-19  Richard Earnshaw  <rearnsha@arm.com> | ||||||
|  |  | ||||||
|  | 	* libc/machine/aarch64/memchr.S: Add check for zero-sized buffer. | ||||||
|  |  | ||||||
| 2014-08-18 Corinna Vinschen  <vinschen@redhat.com> | 2014-08-18 Corinna Vinschen  <vinschen@redhat.com> | ||||||
|  |  | ||||||
| 	* libc/include/sys/signal.h: Declare sigaltstack for RTEMS only. | 	* libc/include/sys/signal.h: Declare sigaltstack for RTEMS only. | ||||||
|   | |||||||
| @@ -79,6 +79,8 @@ | |||||||
| 	.endm | 	.endm | ||||||
|  |  | ||||||
| def_fn memchr | def_fn memchr | ||||||
|  | 	/* Do not dereference srcin if no bytes to compare.  */ | ||||||
|  | 	cbz	cntin, .Lzero_length | ||||||
| 	/* | 	/* | ||||||
| 	 * Magic constant 0x40100401 allows us to identify which lane matches | 	 * Magic constant 0x40100401 allows us to identify which lane matches | ||||||
| 	 * the requested byte. | 	 * the requested byte. | ||||||
| @@ -166,5 +168,9 @@ def_fn memchr | |||||||
| 	csel	result, xzr, result, eq | 	csel	result, xzr, result, eq | ||||||
| 	ret | 	ret | ||||||
|  |  | ||||||
|  | .Lzero_length: | ||||||
|  | 	mov	result, #0 | ||||||
|  | 	ret | ||||||
|  |  | ||||||
| 	.size	memchr, . - memchr | 	.size	memchr, . - memchr | ||||||
| #endif | #endif | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user