-
Notifications
You must be signed in to change notification settings - Fork 512
prevent heap buffer overflow in Teletext demux path #1934
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
base: master
Are you sure you want to change the base?
prevent heap buffer overflow in Teletext demux path #1934
Conversation
3a67f15 to
861db25
Compare
8bfa502 to
0ba941e
Compare
cfsmp3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this security fix! The bounds check is correct and necessary - the teletext path was indeed missing validation that the PES/DVB paths already had.
However, please fix the format specifiers before we can merge:
-
capbuflenisint64_t, so usePRId64instead of%ld:#include <inttypes.h> // ... fatal(CCX_COMMON_EXIT_BUG_BUG, "Teletext packet (%" PRId64 ") larger than remaining buffer (%" PRId64 ").\n", cinfo->capbuflen, (int64_t)(BUFSIZE - ptr->len));
-
Cast
BUFSIZE - ptr->lentoint64_tsince the subtraction involvessize_twhich is platform-dependent.
We're trying to avoid platform-dependent types like size_t in user-facing output and use explicit fixed-width types (int64_t, uint32_t, etc.) where possible for consistency across platforms.
Once you make these changes, we'll be ready to merge. Thanks!
|
@cfsmp3 I’ve updated the code to: Thanks again! |
CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 64ce4ac...:
Your PR breaks these cases:
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 64ce4ac...:
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. |
[FIX] Prevent heap buffer overflow in Teletext demux path
In raising this pull request, I confirm the following (please check boxes):
My familiarity with the project is as follows (check one):
Summary
This pull request fixes a heap buffer overflow in the Teletext demux path
(
CCX_CODEC_TELETEXT) in the functioncopy_capbuf_demux_datain
src/lib_ccx/ts_functions.c.Details
Previously, the code copied
cinfo->capbufinto the destination bufferwithout verifying that there was enough space remaining:
If capbuflen exceeded the remaining buffer space, this caused a heap
buffer overflow, potentially leading to memory corruption or crash.
The generic PES/DVB path already performed a bounds check, but the
Teletext path was missing this validation.
Fix
A bou
nds check is added before copying the Teletext data:
Fixes #1933