Skip to content

segfault in misc-utils/hardlink.c:1013 #2687

@stroucki

Description

@stroucki

I am working with a copy of util-linux-2.39.2, but there seems no functional difference to that file in head.

CFLAGS were "-O0 -g"

(gdb) r -cOvn --reflink=always /tmp/btrfs/chimaera*
...
[DryRun] RefLinking /tmp/btrfs/chimaera-gogs/home/gogs/forgejo/node_modules/tributejs/dist/tribute.js to /tmp/btrfs/chimaera-gogs/home/gogs/forgejo/node_modules/tributejs/example/tribute.js (-64.77 KiB)

Program received signal SIGSEGV, Segmentation fault.
0x0000555555558ba9 in is_reflink (xa=0x55555616da60, xb=0x5555581ac950)
    at misc-utils/hardlink.c:1013
1013                            amap->fm_extents[amap->fm_mapped_extents - 1].fe_logical +
(gdb) print amap->fm_mapped_extents
$1 = 0

I see no check to guard against fm_mapped_extents being zero.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions