Repository navigation
Conversation
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.
Repro: record a session where the peer sends RTP with PT 3 (GSM) and a payload that is not a multiple of 33 bytes, e.g. 34, then run extractaudio on it.
Cause: decode_frame() loops on
ibytes > 0withibytes -= 33on an unsigned int, so after the first frame it calls gsm_decode() on a 1 byte remainder andibyteswraps. The loop then only stops on obytes_max: 25 frames at 8 kHz, about 800 bytes read past the packet into the rest of the mmap()ed recording or past its end, and 4000 ticks of garbage audio in place of 160. An ASan build of the GSM case reports a heap-buffer-overflow READ of size 33 in gsm_decode() for a 34 byte payload.Fix: decode only while a whole frame is left, which is also how rtp_calc_samples() counts GSM (
160 * (nbytes / 33)). Payloads that are a multiple of 33 bytes, including all packets in tests/extractaudio/call1_gsm, decode exactly as before.