Fix null pointer dereference in Matroska parser on file open failure#2171
Fix null pointer dereference in Matroska parser on file open failure#2171apoorvdarshan wants to merge 1 commit intoCCExtractor:masterfrom
Conversation
cfsmp3
left a comment
There was a problem hiding this comment.
Same issue as the feedback on #2157: use fatal(EXIT_READ_ERROR, ...) instead of mprint() + return. If the input file can't be opened, the program should exit with a proper error code, not silently return and appear to succeed. The very next error check in this function (malloc for sub_tracks) uses fatal() — be consistent.
Also remove the CHANGES.TXT entry — this is an internal fix, not a user-reported bug.
create_file() returns the result of fopen() which can be NULL if the file cannot be opened. matroska_loop() never checked this, passing the NULL pointer into matroska_parse() where it is immediately used in feof(), causing a crash. Add a NULL check that calls fatal(EXIT_READ_ERROR, ...) on failure, consistent with other file-open error handling in the codebase.
b6c17c2 to
43ee251
Compare
CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 90128d8...:
Your PR breaks these cases:
NOTE: The following tests have been failing on the master branch as well as the PR:
Congratulations: Merging this PR would fix the following tests:
It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you). Check the result page for more info. |
CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit e4bcade...:
NOTE: The following tests have been failing on the master branch as well as the PR:
Congratulations: Merging this PR would fix the following tests:
This PR does not introduce any new test failures. However, some tests are failing on both master and this PR (see above). Check the result page for more info. |
Summary
create_file()returns the result offopen()without checking for NULLmatroska_loop()passes this directly intomatroska_parse(), which callsfeof()on the NULL pointer, crashing the programcreate_file()that prints an error, freesmkv_ctx, and returns-1Test plan