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

Possible use after-free #161

Open
i124q2n8 opened this issue Nov 26, 2023 · 0 comments
Open

Possible use after-free #161

i124q2n8 opened this issue Nov 26, 2023 · 0 comments

Comments

@i124q2n8
Copy link

Environment: Docker (alpine, musl)

Bam sometimes crashes with a segfault. After debugging with gdb (i think) i found the issue. Swapping the callback with free seems to fix the problem.

bam/src/support.c

Lines 381 to 383 in 47e5575

free(entry);
/* call the callback */
callback(buffer, entry->d_name, isdir, user);

Details:

(gdb) backtrace
#0  0x00007f533f1641f7 in strlen () from /lib/ld-musl-x86_64.so.1
#1  0x0000558cdbda9903 in collect_callback (
    fullpath=0x7ffefb902ce0 "path/to/file.hh", 
    filename=0x7f533eff3033 <error: Cannot access memory at address 0x7f533eff3033>, dir=0, 
    user=0x7ffefb903560) at src/luafuncs.c:1010
...
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