Skip to content

Possible use after-free #161

@i124q2n8

Description

@i124q2n8

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
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions