-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
heap buffer overflow is expected #103
Comments
Hi yuweol, Thanks for the report. There could be a memory bug in mpc however I can see some bugs in your code which are probably worth fixing first: In In Finally, I also sometimes get heap memory errors when using mpc which come from inside functions such as If you attach the full report/output I can take a closer look. Hope that helps, Dan |
Hello, Thanks for your reply. <bug1.c>==6458==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf51005ef at pc 0x0817cc32 bp 0xfffac958 sp 0xfffac94c 0xf51005ef is located 1 bytes to the left of 1-byte region [0xf51005f0,0xf51005f1) SUMMARY: AddressSanitizer: heap-buffer-overflow mpc.c:2135:10 in mpcf_strtrimr <bug2.c>==7438==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf5020314 at pc 0x08129b01 bp 0xff9e9968 sp 0xff9e9540 0xf5020314 is located 0 bytes to the right of 4-byte region [0xf5020310,0xf5020314) SUMMARY: AddressSanitizer: heap-buffer-overflow (bug2+0x8129b00) in __asan_memmove As you can see, address sanitizer found a bug and forcefully terminated a program while each mpc_parse, mpca_lang function was working. Thanks. |
Thanks for the full report I will look into it a bit more. |
I wasn't able to reproduce these crashes. I think I need to use valgrind to get more information on this which means installing Ubuntu however I am still surprised you are getting errors in this case. These sort of examples have been tried and tested many times... |
Hello.
While i'm writing a code with mpc.c, address sanitizer reported a heap buffer overflow.
I attached a file. (both bug1.c and bug2.c can cause heap buffer overflow. please test them separately.)
commit number : 3c26618
And the build command I used is below.
clang -fsanitize=address -m32 -g -ansi -pedantic -O3 -Wall -Wextra -Wformat=2 -Wshadow -Wno-long-long -Wno-overlength-strings -Wno-format-nonliteral -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wold-style-definition -Wredundant-decls -Wnested-externs -Wmissing-include-dirs -Wswitch-default -o bug1 bug1.c ./mpc.c && ./bug1
clang -fsanitize=address -m32 -g -ansi -pedantic -O3 -Wall -Wextra -Wformat=2 -Wshadow -Wno-long-long -Wno-overlength-strings -Wno-format-nonliteral -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wold-style-definition -Wredundant-decls -Wnested-externs -Wmissing-include-dirs -Wswitch-default -o bug2 bug2.c ./mpc.c && ./bug2
It may my problem because I didn't fully understand this code, but anyway please check this.
bug.zip
The text was updated successfully, but these errors were encountered: