[FFmpeg-trac] #7597(avformat:new): AV_PKT_DATA_MPEGTS_STREAM_ID is broken
FFmpeg
trac at avcodec.org
Thu Dec 6 17:23:20 EET 2018
#7597: AV_PKT_DATA_MPEGTS_STREAM_ID is broken
----------------------------------+--------------------------------------
Reporter: vagran | Type: defect
Status: new | Priority: normal
Component: avformat | Version: git-master
Keywords: mpegts | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
----------------------------------+--------------------------------------
In current master (90ac0e5f29ba4730cd92d3268938b3730823e52b).
mpegtsenc.c:1526
{{{
char *side_data = NULL;
int stream_id = -1;
side_data = av_packet_get_side_data(pkt,
AV_PKT_DATA_MPEGTS_STREAM_ID,
&side_data_size);
if (side_data)
stream_id = side_data[0];
}}}
One-byte stream ID is read from "char *" array to integer making it to
sign-extend which is not correct. Although it writes it correctly to
stream, since it is treated as one byte again, but it fails with some
condition checks, e.g. in mpegtsenc.c:1278:
{{{
if (stream_id == 0xbd) /* asynchronous KLV */
pts = dts = AV_NOPTS_VALUE;
}}}
stream_id value in such case is 0xffffffbd.
Fix should be changing side_data type from "char *" to "uint8_t *".
--
Ticket URL: <https://trac.ffmpeg.org/ticket/7597>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list