[Ffmpeg-devel] [PATCH] Fix crush when truncated slice passed to H.264 decoder

Alexander Chemeris ipse.ffmpeg
Tue Dec 5 19:26:38 CET 2006

Hello all,

This patch corrects FFMpeg's behaviour in case where H.264 slice
come to decoder truncated. This may occure when you receive
video stream from net and could not use big buffer on input to conceal
network jitter. It is common case for video telephony over Internet.

At svn rev 7225 FFMpeg often crashes when you pass incomplete slice
to decoder. You could reproduce this with attached H.264 frame and
ffmpeg executable:

% ffmpeg -f h264 -i crash.h264

The cause of this crash is decoder continue reading from stream, even
if no more data is available. In this case get_vlc2() seems to return -1,
so I add sheck for negative return result when total_coeff is read from stream.
It would be better to check every return result, but this will slow
down decoding.
Though some other values are checked, and it seems frequent crashes go
away with this fix. If more crashes will arise on bigger array of
tests, I'll report

Alexander Chemeris.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_H264_corrupted_frames_crash.patch
Type: application/octet-stream
Size: 503 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20061205/e018eefa/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: crash.h264
Type: application/octet-stream
Size: 4380 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20061205/e018eefa/attachment-0001.obj>

More information about the ffmpeg-devel mailing list