Sourceware Bugzilla – Attachment 6685 Details for
Bug 14716
memmem crash
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
.c crash reproducer.
memmem.c (text/plain), 845 bytes, created by
Jan Kratochvil
on 2012-10-14 06:21:54 UTC
(
hide
)
Description:
.c crash reproducer.
Filename:
MIME Type:
Creator:
Jan Kratochvil
Created:
2012-10-14 06:21:54 UTC
Size:
845 bytes
patch
obsolete
>#define _GNU_SOURCE >#include <string.h> >#include <assert.h> >#include <sys/mman.h> >#include <stdint.h> >#include <stdlib.h> >#include <unistd.h> > >int >main (void) >{ > const size_t ps = sysconf (_SC_PAGESIZE); > void *search_buf_page = mmap (NULL, ps + ps, PROT_READ | PROT_WRITE, > MAP_SHARED | MAP_ANONYMOUS, -1, 0); > assert (search_buf_page != MAP_FAILED); > int i = mprotect (search_buf_page + ps, ps, PROT_NONE); > assert (i == 0); > const size_t nr_search_bytes = 5; > const char search_buf_data[5] = { 0x56, 0x34, 0x12, 0x78, 0x78 }; > void *search_buf = search_buf_page + ps - nr_search_bytes; > memcpy (search_buf, search_buf_data, nr_search_bytes); > const size_t pattern_len = 2; > const char pattern[2] = { 0x78, 0x56 }; > return (memmem (search_buf, nr_search_bytes, pattern, pattern_len) == NULL > ? EXIT_SUCCESS : EXIT_FAILURE); >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 14716
:
6683
|
6684
| 6685