Menu

#101 aide crashes on guile .go files

0.13
closed-fixed
nobody
None
5
2019-03-16
2017-06-23
No

aide crashes on .go files:

Program received signal SIGFPE, Arithmetic exception.
0x000055555556b857 in is_prelinked (fd=6) at src/do_md.c:104
104                             int maxndx = data->d_size / shdr.sh_entsize;
(gdb) bt
#0  0x000055555556b857 in is_prelinked (fd=6) at src/do_md.c:104
#1  0x000055555556be8f in calc_md (old_fs=0x7fffffffe380, line=0x555555796fc0) at src/do_md.c:261
#2  0x0000555555570144 in get_file_attrs (filename=0x5555557981c0 "/home/lukas/aide-test/test/gnutls.go", attr=132072864702, fs=0x7fffffffe380) at src/gen_list.c:1109
#3  0x0000555555566e77 in db_readline_disk () at src/db_disk.c:261
#4  0x0000555555564cb8 in db_readline (db=256) at src/db.c:254
#5  0x0000555555570399 in populate_tree (tree=0x555555792f00) at src/gen_list.c:1176
#6  0x0000555555558a36 in main (argc=3, argv=0x7fffffffe618) at src/aide.c:629
(gdb)

The shdr.sh_entsize is indeed 0 for such files. Attached is an example problematic file.

1 Attachments

Discussion

  • Divya Basant

    Divya Basant - 2018-03-14

    Below patch should fix this issue.

    --- b/src/do_md.c 2018-02-14 14:52:39.580959240 +0530
    +++ a/src/do_md.c 2018-02-14 14:53:52.212951761 +0530
    @@ -135,7 +135,11 @@
    continue;

                 while (!bingo && (data = elf_getdata (scn, data)) != NULL) {
    
    • int maxndx = data->d_size / shdr.sh_entsize;
    • int maxndx;
    • if (shdr.sh_entsize)
    • maxndx = data->d_size / shdr.sh_entsize;
    • else
    • break;
      int ndx;
                       for (ndx = 0; ndx < maxndx; ++ndx) {
      
     
  • Marek Tamaskovic

    Patch proposal

    Here is my proposal for a patch.
    I don't think that it is good to break from that while loop because there can be some data in next iteration over elf_getdata().
    Next thing is that the first patch doesn't continue in project code style.

     
  • Hannes von Haugwitz

    Is shdr.sh_entsize even changed by the elf_getdata call? If not 'shdr.sh_entsize == 0' could be added to the if condition before the while loop.

     
  • Hannes von Haugwitz

    • status: open --> closed-fixed
     
  • Hannes von Haugwitz

    fixed (commit dd98dbd)

     

Log in to post a comment.

MongoDB Logo MongoDB