mtvdemuxer: fix segfault caused by truncated packets.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f890cb948c932e3b01f9a616ff1600769c539853)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2011-12-16 16:23:47 +01:00
parent 5ca4ec76b7
commit c55b158b87

View File

@ -196,7 +196,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
* just swap bytes as they come
*/
for(i=0;i<mtv->img_segment_size/2;i++)
for(i=0;i<ret/2;i++)
*((uint16_t *)pkt->data+i) = av_bswap16(*((uint16_t *)pkt->data+i));
#endif
pkt->stream_index = 0;