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
AddressSanitizer: multiple double-free in box_code_base.c #1090
Comments
This one is trickier than the others. It's the same issue as #1077 Unfortunately there are no easy solutions. A nullity check wouldn't be enough because we only nullify a copy of the pointer so the check would fail. Fixing this would require changing the signature of a massive amount of functions, which is not great. We'll have to take some time to think of a proper solution for this one. |
as a reminder for future reference: most of these come from the use of ERROR_ON_DUPLICATED_BOX another case, reported in #1104 with this file : https://github.com/ntu-sec/pocs/blob/master/gpac-776dd7b6c/crashes/read_box_code_meta.c:854_1.txt comes from gf_isom_box_add_for_dump_mode when we add to other_boxes boxes that are added elsewhere (in meta -> item_refs for example) and then trying to delete both leads to double free |
We found with our fuzzer multiple double-free errors when gpac bceb03f is compiled with address sanitizer. These crashes can be triggered with
./MP4Box -diso $POC
.POC files (open link and get the raw file on that page):
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c:1618_1.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c:1618_2.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c:2889_1.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c:2889_2.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A3468_1.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A3468_2.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A371_1.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A371_2.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A4557_1.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A4557_2.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A4679_1.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A4679_2.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A4875_1.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A4875_2.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A5453_1.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A5453_2.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A5847_1.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A5911_1.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A6138_1.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A6138_2.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A6367_1.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A6367_2.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A714_1.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A714_2.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A715_1.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A715_2.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A7949_1.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A7949_2.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A8319_1.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A902_1.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A902_2.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_box_code_base.c%3A974_1.mp4
https://github.com/ntu-sec/pocs/blob/master/gpac-bceb03f/crashes/df_descriptors.c%3A537_1.mp4
gdb backtrace is like:
A nullity check inside
gf_free
may work but I'm not sure whether that's your preferred way.The text was updated successfully, but these errors were encountered: