Opened 7 days ago

Closed 6 days ago

#7597 closed defect (fixed)

AV_PKT_DATA_MPEGTS_STREAM_ID is broken

Reported by: vagran Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: mpegts
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

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 *".

Change History (2)

comment:1 Changed 7 days ago by cehoyos

Please send your patch made with git format-patch to the FFmpeg development mailing list, patches and patch suggestions are ignored here.

comment:2 Changed 6 days ago by cehoyos

  • Resolution set to fixed
  • Status changed from new to closed

Your patch was applied as 6b1c4ce8cf600f6bd7e48b6971527b56a31b9fab - thank you for the fix!

Note: See TracTickets for help on using tickets.