Repository navigation
[FIX] Fix EPG crash on empty extended event text - #2389
Merged
Merged
Conversation
EPG_decode_extended_event_descriptor() strips a leading character-table byte from a continuation descriptor (descriptor_number > 0) when the first text byte is below 0x20. When text_length is 0 that byte is not text but whatever follows the descriptor, and the decrement wraps the uint32_t length to 0xFFFFFFFF, so the following memcpy reads 4 GB and --xmltv segfaults. An empty text field is legal: some broadcasters put all extended event content in the item fields. Only strip the byte when there is text to strip.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In raising this pull request, I confirm the following (please check boxes):
Reason for this PR:
Sanity check:
Repro instructions:
ccextractor 4b117b4d66e81f393a67a07358d143beeb4f384dc9d1c640761f7eeca9f707e7.ts --xmltv 1(a DVB recording from our sample set) segfaults (exit 139). The 75 EIT packets (PID 0x12) from its first 2 MB, 14,100 bytes, reproduce it on their own; under ASan: heap-buffer-overflow, READ of size 4294967295 inmemcpyfromEPG_decode_extended_event_descriptor(ts_tables_epg.c:993).EPG_decode_extended_event_descriptor()strips a leading character-table byte from a continuation descriptor (descriptor_number > 0) when the first text byte is below 0x20. Whentext_lengthis 0, that byte isn't text but whatever follows the descriptor, andtext_length--wraps theuint32_tto 0xFFFFFFFF, so the followingmemcpyreads 4 GB. An empty text field is legal — this broadcaster puts all extended event content in the item fields (the crashing call: descriptor 3,text_length0, next byte 0x09). This only strips the byte when there is text to strip.Verified:
--xmltv 1: output and exit codes identical to master, except the crashing sample.