Skip to content
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

memory leak in mpca_lang function #161

Open
NotmebutWind opened this issue May 5, 2023 · 0 comments
Open

memory leak in mpca_lang function #161

NotmebutWind opened this issue May 5, 2023 · 0 comments

Comments

@NotmebutWind
Copy link

there is memory leak in mpca_lang function
1、 compile the lib with asan : make CC=gcc -fsanitize=address -g
2、test.c:
example/foobar.c
3、input:
char* foobar = "#@$^^&^(\x00";
argv[1] = "#@$^^&
^(\x00";
4 compile and run ,find crash:

=================================================================
==2182132==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 72 byte(s) in 1 object(s) allocated from:
#0 0x7fc4e00dc867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
#1 0x55a33cc0476e in mpc_malloc ../mpc.c:241
#2 0x55a33cc09120 in mpc_err_or ../mpc.c:760
#3 0x55a33cc0a6ed in mpc_err_merge ../mpc.c:878
#4 0x55a33cc0e3b8 in mpc_parse_input ../mpc.c:1318
#5 0x55a33cc1fc6b in mpca_lang_st ../mpc.c:3724
#6 0x55a33cc2068b in mpca_lang ../mpc.c:3794
#7 0x55a33cc02f7e in fuzzloop ../examples/foobar.c:11
#8 0x55a33cc2ac89 in fuzzFunction ./wrapentry.c:98
Indirect leak of 192 byte(s) in 3 object(s) allocated from:
#0 0x7fc4e00dc867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
#1 0x55a33cc04b7f in mpc_export ../mpc.c:289
#2 0x55a33cc08b50 in mpc_err_export ../mpc.c:723
#3 0x55a33cc0e3cd in mpc_parse_input ../mpc.c:1318
#4 0x55a33cc1fc6b in mpca_lang_st ../mpc.c:3724
#5 0x55a33cc2068b in mpca_lang ../mpc.c:3794
#6 0x55a33cc02f7e in fuzzloop ../examples/foobar.c:11
#7 0x55a33cc2ac89 in fuzzFunction ./wrapentry.c:98
Indirect leak of 64 byte(s) in 1 object(s) allocated from:
#0 0x7fc4e00dc867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
#1 0x55a33cc04b7f in mpc_export ../mpc.c:289
#2 0x55a33cc08c69 in mpc_err_export ../mpc.c:726
#3 0x55a33cc0e3cd in mpc_parse_input ../mpc.c:1318
#4 0x55a33cc1fc6b in mpca_lang_st ../mpc.c:3724
#5 0x55a33cc2068b in mpca_lang ../mpc.c:3794
#6 0x55a33cc02f7e in fuzzloop ../examples/foobar.c:11
#7 0x55a33cc2ac89 in fuzzFunction ./wrapentry.c:98
Indirect leak of 24 byte(s) in 1 object(s) allocated from:
#0 0x7fc4e00dcc18 in __interceptor_realloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:164
#1 0x55a33cc04abe in mpc_realloc ../mpc.c:274
#2 0x55a33cc08ee4 in mpc_err_add_expected ../mpc.c:743
#3 0x55a33cc09a14 in mpc_err_or ../mpc.c:787
#4 0x55a33cc0a6ed in mpc_err_merge ../mpc.c:878
#5 0x55a33cc0e3b8 in mpc_parse_input ../mpc.c:1318
#6 0x55a33cc1fc6b in mpca_lang_st ../mpc.c:3724
#7 0x55a33cc2068b in mpca_lang ../mpc.c:3794
#8 0x55a33cc02f7e in fuzzloop ../examples/foobar.c:11
#9 0x55a33cc2ac89 in fuzzFunction ./wrapentry.c:98
SUMMARY: AddressSanitizer: 352 byte(s) leaked in 6 allocation(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant