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

Make all thrown SleuthkitCase exceptions checked #4

Merged
merged 1 commit into from Nov 3, 2011
Merged

Make all thrown SleuthkitCase exceptions checked #4

merged 1 commit into from Nov 3, 2011

Conversation

pidge
Copy link

@pidge pidge commented Nov 3, 2011

Make all thrown exceptions checked (TskExceptions), also add some more details to messages.

bcarrier added a commit that referenced this pull request Nov 3, 2011
Make all thrown SleuthkitCase exceptions checked
@bcarrier bcarrier merged commit 1377153 into sleuthkit:master Nov 3, 2011
This was referenced Sep 26, 2017
@Google-Autofuzz Google-Autofuzz mentioned this pull request Nov 8, 2017
aryabinin added a commit to aryabinin/sleuthkit that referenced this pull request Apr 10, 2018
If key->key_len is 65535, calculating "uint16_t keylen' would
cause an overflow:

   uint16_t keylen;
   ...
   keylen = 2 + tsk_getu16(hfs->fs_info.endian, key->key_len)

so the code bypasses the sanity check "if (keylen > nodesize)"
which results in crash later:

    ./toolfs/fstools/fls -b 512 -f hfs <image>
    =================================================================
    ==16==ERROR: AddressSanitizer: SEGV on unknown address 0x6210000256a4 (pc 0x00000054812b bp 0x7ffca548a8f0 sp 0x7ffca548a480 T0)
    ==16==The signal is caused by a READ memory access.
        #0 0x54812a in hfs_dir_open_meta_cb /fuzzing/sleuthkit/tsk/fs/hfs_dent.c:237:20
        sleuthkit#1 0x51a96c in hfs_cat_traverse /fuzzing/sleuthkit/tsk/fs/hfs.c:1082:21
        sleuthkit#2 0x547785 in hfs_dir_open_meta /fuzzing/sleuthkit/tsk/fs/hfs_dent.c:480:9
        sleuthkit#3 0x50f57d in tsk_fs_dir_open_meta /fuzzing/sleuthkit/tsk/fs/fs_dir.c:290:14
        sleuthkit#4 0x54af17 in tsk_fs_path2inum /fuzzing/sleuthkit/tsk/fs/ifind_lib.c:237:23
        sleuthkit#5 0x522266 in hfs_open /fuzzing/sleuthkit/tsk/fs/hfs.c:6579:9
        sleuthkit#6 0x508e89 in main /fuzzing/sleuthkit/tools/fstools/fls.cpp:267:19
        sleuthkit#7 0x7f9daf67c2b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
        sleuthkit#8 0x41d679 in _start (/fuzzing/sleuthkit/tools/fstools/fls+0x41d679)

Make 'keylen' int type to prevent the overflow and fix that.
Now, I get proper error message instead of crash:
    ./toolfs/fstools/fls -b 512 -f hfs <image>
    General file system error (hfs_cat_traverse: length of key 3 in leaf node 1 too large (65537 vs 4096))
rcordovano pushed a commit that referenced this pull request Apr 18, 2018
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

Successfully merging this pull request may close these issues.

None yet

2 participants