| Index: patches/ugly/13_get_bits_overrun.patch
|
| ===================================================================
|
| --- patches/ugly/13_get_bits_overrun.patch (revision 41250)
|
| +++ patches/ugly/13_get_bits_overrun.patch (working copy)
|
| @@ -1,8 +1,68 @@
|
| -Index: patched-ffmpeg-mt/libavcodec/get_bits.h
|
| -===================================================================
|
| ---- patched-ffmpeg-mt/libavcodec/get_bits.h (revision 40662)
|
| -+++ patched-ffmpeg-mt/libavcodec/get_bits.h (working copy)
|
| -@@ -74,13 +74,21 @@
|
| +Only in unpatched_ffmpeg-mt: ffmpeg-mt
|
| +diff -rpu unpatched_ffmpeg-mt/libavcodec/Makefile ffmpeg-mt/libavcodec/Makefile
|
| +--- unpatched_ffmpeg-mt/libavcodec/Makefile 2010-03-11 17:46:30 -0800
|
| ++++ ffmpeg-mt/libavcodec/Makefile 2010-03-11 19:12:33 -0800
|
| +@@ -493,8 +493,7 @@ OBJS-$(CONFIG_MATROSKA_MUXER) +
|
| + OBJS-$(CONFIG_MOV_DEMUXER) += mpeg4audio.o mpegaudiodata.o
|
| + OBJS-$(CONFIG_MPEGTS_MUXER) += mpegvideo.o
|
| + OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o
|
| +-OBJS-$(CONFIG_OGG_DEMUXER) += flacdec.o flacdata.o flac.o \
|
| +- dirac.o mpeg12data.o
|
| ++OBJS-$(CONFIG_OGG_DEMUXER) += dirac.o mpeg12data.o
|
| + OBJS-$(CONFIG_OGG_MUXER) += xiph.o flacdec.o flacdata.o flac.o
|
| + OBJS-$(CONFIG_RTP_MUXER) += mpegvideo.o
|
| +
|
| +@@ -564,6 +563,14 @@ OBJS-$(CONFIG_VP3_PARSER) +
|
| + OBJS-$(CONFIG_AAC_ADTSTOASC_BSF) += aac_adtstoasc_bsf.o
|
| + OBJS-$(CONFIG_DUMP_EXTRADATA_BSF) += dump_extradata_bsf.o
|
| + OBJS-$(CONFIG_H264_MP4TOANNEXB_BSF) += h264_mp4toannexb_bsf.o
|
| ++OBJS-$(CONFIG_MPEG4VIDEO_ES_BSF) += mpeg4video_es_bsf.o \
|
| ++ mpeg4videoenc.o ituh263enc.o \
|
| ++ mpegvideo_enc.o motion_est.o \
|
| ++ ratecontrol.o mpeg12data.o \
|
| ++ aandcttab.o jfdctfst.o \
|
| ++ jfdctint.o faandct.o \
|
| ++ mpeg4video_parser.o mpegvideo.o \
|
| ++ error_resilience.o
|
| + OBJS-$(CONFIG_IMX_DUMP_HEADER_BSF) += imx_dump_header_bsf.o
|
| + OBJS-$(CONFIG_MJPEGA_DUMP_HEADER_BSF) += mjpega_dump_header_bsf.o
|
| + OBJS-$(CONFIG_MOV2TEXTSUB_BSF) += movsub_bsf.o
|
| +@@ -573,6 +580,9 @@ OBJS-$(CONFIG_MP3_HEADER_DECOMPRESS_BSF)
|
| + OBJS-$(CONFIG_NOISE_BSF) += noise_bsf.o
|
| + OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF) += remove_extradata_bsf.o
|
| + OBJS-$(CONFIG_TEXT2MOVSUB_BSF) += movsub_bsf.o
|
| ++OBJS-$(CONFIG_VC1_ASFTORCV_BSF) += vc1_asftorcv_bsf.o
|
| ++OBJS-$(CONFIG_VC1_ASFTOANNEXG_BSF) += vc1_asftoannexg_bsf.o vc1.o \
|
| ++ vc1data.o
|
| +
|
| + # thread libraries
|
| + OBJS-$(HAVE_BEOSTHREADS) += beosthread.o
|
| +Only in ffmpeg-mt/libavcodec: Makefile~
|
| +diff -rpu unpatched_ffmpeg-mt/libavcodec/allcodecs.c ffmpeg-mt/libavcodec/allcodecs.c
|
| +--- unpatched_ffmpeg-mt/libavcodec/allcodecs.c 2010-03-11 17:46:29 -0800
|
| ++++ ffmpeg-mt/libavcodec/allcodecs.c 2010-03-11 19:12:19 -0800
|
| +@@ -384,13 +384,15 @@ void avcodec_register_all(void)
|
| + REGISTER_BSF (AAC_ADTSTOASC, aac_adtstoasc);
|
| + REGISTER_BSF (DUMP_EXTRADATA, dump_extradata);
|
| + REGISTER_BSF (H264_MP4TOANNEXB, h264_mp4toannexb);
|
| ++ REGISTER_BSF (MPEG4VIDEO_ES, mpeg4video_es);
|
| + REGISTER_BSF (IMX_DUMP_HEADER, imx_dump_header);
|
| + REGISTER_BSF (MJPEGA_DUMP_HEADER, mjpega_dump_header);
|
| + REGISTER_BSF (MP3_HEADER_COMPRESS, mp3_header_compress);
|
| + REGISTER_BSF (MP3_HEADER_DECOMPRESS, mp3_header_decompress);
|
| ++ REGISTER_BSF (VC1_ASFTORCV, vc1_asftorcv);
|
| ++ REGISTER_BSF (VC1_ASFTOANNEXG, vc1_asftoannexg);
|
| + REGISTER_BSF (MOV2TEXTSUB, mov2textsub);
|
| + REGISTER_BSF (NOISE, noise);
|
| + REGISTER_BSF (REMOVE_EXTRADATA, remove_extradata);
|
| + REGISTER_BSF (TEXT2MOVSUB, text2movsub);
|
| + }
|
| +-
|
| +Only in ffmpeg-mt/libavcodec: allcodecs.c~
|
| +diff -rpu unpatched_ffmpeg-mt/libavcodec/get_bits.h ffmpeg-mt/libavcodec/get_bits.h
|
| +--- unpatched_ffmpeg-mt/libavcodec/get_bits.h 2010-03-11 17:46:30 -0800
|
| ++++ ffmpeg-mt/libavcodec/get_bits.h 2010-03-11 19:13:14 -0800
|
| +@@ -53,13 +53,21 @@
|
| /* buffer, buffer_end and size_in_bits must be present and used by every reader */
|
| typedef struct GetBitContext {
|
| const uint8_t *buffer, *buffer_end;
|
| @@ -24,7 +84,7 @@
|
| uint32_t *buffer_ptr;
|
| uint32_t cache0;
|
| uint32_t cache1;
|
| -@@ -160,13 +168,19 @@
|
| +@@ -139,13 +147,19 @@ for examples see get_bits, show_bits, sk
|
|
|
| # ifdef ALT_BITSTREAM_READER_LE
|
| # define UPDATE_CACHE(name, gb)\
|
| @@ -44,7 +104,7 @@
|
|
|
| # define SKIP_CACHE(name, gb, num)\
|
| name##_cache <<= (num);
|
| -@@ -175,6 +189,8 @@
|
| +@@ -154,6 +168,8 @@ for examples see get_bits, show_bits, sk
|
| // FIXME name?
|
| # define SKIP_COUNTER(name, gb, num)\
|
| name##_index += (num);\
|
| @@ -53,7 +113,7 @@
|
|
|
| # define SKIP_BITS(name, gb, num)\
|
| {\
|
| -@@ -208,6 +224,12 @@
|
| +@@ -187,6 +203,12 @@ static inline int get_bits_count(const G
|
|
|
| static inline void skip_bits_long(GetBitContext *s, int n){
|
| s->index += n;
|
| @@ -66,7 +126,7 @@
|
| }
|
|
|
| #elif defined LIBMPEG2_BITSTREAM_READER
|
| -@@ -412,7 +434,10 @@
|
| +@@ -391,7 +413,10 @@ static inline void skip_bits(GetBitConte
|
| }
|
|
|
| static inline unsigned int get_bits1(GetBitContext *s){
|
| @@ -77,7 +137,7 @@
|
| unsigned int index= s->index;
|
| uint8_t result= s->buffer[ index>>3 ];
|
| #ifdef ALT_BITSTREAM_READER_LE
|
| -@@ -423,9 +448,12 @@
|
| +@@ -402,9 +427,12 @@ static inline unsigned int get_bits1(Get
|
| result>>= 8 - 1;
|
| #endif
|
| index++;
|
| @@ -90,7 +150,7 @@
|
| #else
|
| return get_bits(s, 1);
|
| #endif
|
| -@@ -503,6 +531,8 @@
|
| +@@ -482,6 +510,8 @@ static inline void init_get_bits(GetBitC
|
| s->buffer= buffer;
|
| s->size_in_bits= bit_size;
|
| s->buffer_end= buffer + buffer_size;
|
| @@ -99,3 +159,250 @@
|
| #ifdef ALT_BITSTREAM_READER
|
| s->index=0;
|
| #elif defined LIBMPEG2_BITSTREAM_READER
|
| +Only in ffmpeg-mt/libavcodec: get_bits.h~
|
| +diff -rpu unpatched_ffmpeg-mt/libavcodec/h264.h ffmpeg-mt/libavcodec/h264.h
|
| +--- unpatched_ffmpeg-mt/libavcodec/h264.h 2010-03-11 17:46:30 -0800
|
| ++++ ffmpeg-mt/libavcodec/h264.h 2010-03-11 19:12:59 -0800
|
| +@@ -599,9 +599,20 @@ typedef struct H264Context{
|
| +
|
| + extern const uint8_t ff_h264_chroma_qp[52];
|
| +
|
| ++#if CONFIG_SVQ3_DECODER
|
| + void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *block, int qp);
|
| +
|
| + void ff_svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc);
|
| ++#else
|
| ++
|
| ++#define SVQ3_DISABLED_FUNC { av_log(NULL, AV_LOG_FATAL, "Calling svq3 when disabled.\n"); }
|
| ++
|
| ++static void inline ff_svq3_luma_dc_dequant_idct_c(DCTELEM *block, int qp) SVQ3_DISABLED_FUNC;
|
| ++
|
| ++static void inline ff_svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc) SVQ3_DISABLED_FUNC;
|
| ++
|
| ++#endif
|
| ++
|
| +
|
| + /**
|
| + * Decode SEI
|
| +Only in ffmpeg-mt/libavcodec: h264.h~
|
| +diff -rpu unpatched_ffmpeg-mt/libavcodec/mpeg4video.h ffmpeg-mt/libavcodec/mpeg4video.h
|
| +--- unpatched_ffmpeg-mt/libavcodec/mpeg4video.h 2010-03-11 17:46:30 -0800
|
| ++++ ffmpeg-mt/libavcodec/mpeg4video.h 2010-03-11 19:12:02 -0800
|
| +@@ -91,6 +91,9 @@ void mpeg4_encode_mb(MpegEncContext *s,
|
| + void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
|
| + int dir);
|
| + void ff_set_mpeg4_time(MpegEncContext * s);
|
| ++void mpeg4_encode_gop_header(MpegEncContext * s);
|
| ++void mpeg4_encode_visual_object_header(MpegEncContext * s);
|
| ++void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_number);
|
| + void mpeg4_encode_picture_header(MpegEncContext *s, int picture_number);
|
| +
|
| + int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb);
|
| +Only in ffmpeg-mt/libavcodec: mpeg4video.h~
|
| +Only in ffmpeg-mt/libavcodec: mpeg4video_es_bsf.c
|
| +diff -rpu unpatched_ffmpeg-mt/libavcodec/mpeg4videoenc.c ffmpeg-mt/libavcodec/mpeg4videoenc.c
|
| +--- unpatched_ffmpeg-mt/libavcodec/mpeg4videoenc.c 2010-03-11 17:46:30 -0800
|
| ++++ ffmpeg-mt/libavcodec/mpeg4videoenc.c 2010-03-11 19:12:02 -0800
|
| +@@ -872,7 +872,7 @@ void ff_set_mpeg4_time(MpegEncContext *
|
| + }
|
| + }
|
| +
|
| +-static void mpeg4_encode_gop_header(MpegEncContext * s){
|
| ++void mpeg4_encode_gop_header(MpegEncContext * s){
|
| + int hours, minutes, seconds;
|
| + int64_t time;
|
| +
|
| +@@ -902,7 +902,7 @@ static void mpeg4_encode_gop_header(Mpeg
|
| + ff_mpeg4_stuffing(&s->pb);
|
| + }
|
| +
|
| +-static void mpeg4_encode_visual_object_header(MpegEncContext * s){
|
| ++void mpeg4_encode_visual_object_header(MpegEncContext * s){
|
| + int profile_and_level_indication;
|
| + int vo_ver_id;
|
| +
|
| +@@ -947,7 +947,7 @@ static void mpeg4_encode_visual_object_h
|
| + ff_mpeg4_stuffing(&s->pb);
|
| + }
|
| +
|
| +-static void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_number)
|
| ++void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_number)
|
| + {
|
| + int vo_ver_id;
|
| +
|
| +Only in ffmpeg-mt/libavcodec: vc1_asftoannexg_bsf.c
|
| +Only in ffmpeg-mt/libavcodec: vc1_asftorcv_bsf.c
|
| +diff -rpu unpatched_ffmpeg-mt/libavformat/Makefile ffmpeg-mt/libavformat/Makefile
|
| +--- unpatched_ffmpeg-mt/libavformat/Makefile 2010-03-11 17:46:31 -0800
|
| ++++ ffmpeg-mt/libavformat/Makefile 2010-03-11 19:12:33 -0800
|
| +@@ -141,13 +141,13 @@ OBJS-$(CONFIG_NUT_DEMUXER)
|
| + OBJS-$(CONFIG_NUT_MUXER) += nutenc.o nut.o riff.o
|
| + OBJS-$(CONFIG_NUV_DEMUXER) += nuv.o riff.o
|
| + OBJS-$(CONFIG_OGG_DEMUXER) += oggdec.o \
|
| +- oggparsedirac.o \
|
| +- oggparseflac.o \
|
| + oggparseogm.o \
|
| +- oggparsespeex.o \
|
| + oggparsetheora.o \
|
| + oggparsevorbis.o \
|
| + riff.o
|
| ++OBJS-$(CONFIG_DIRAC_DEMUXER) += oggparsedirac.o
|
| ++OBJS-$(CONFIG_FLAC_DECODER) += oggparseflac.o
|
| ++OBJS-$(CONFIG_LIBSPEEX) += oggparsespeex.o
|
| + OBJS-$(CONFIG_OGG_MUXER) += oggenc.o
|
| + OBJS-$(CONFIG_OMA_DEMUXER) += oma.o raw.o
|
| + OBJS-$(CONFIG_PCM_ALAW_DEMUXER) += raw.o
|
| +diff -rpu unpatched_ffmpeg-mt/libavformat/mov.c ffmpeg-mt/libavformat/mov.c
|
| +--- unpatched_ffmpeg-mt/libavformat/mov.c 2010-03-11 17:46:31 -0800
|
| ++++ ffmpeg-mt/libavformat/mov.c 2010-03-11 19:08:40 -0800
|
| +@@ -312,6 +312,8 @@ static int mov_read_dref(MOVContext *c,
|
| + MOVDref *dref = &sc->drefs[i];
|
| + uint32_t size = get_be32(pb);
|
| + int64_t next = url_ftell(pb) + size - 4;
|
| ++ if (size < 8)
|
| ++ return -1;
|
| +
|
| + dref->type = get_le32(pb);
|
| + get_be32(pb); // version + flags
|
| +Only in ffmpeg-mt/libavformat: mov.c~
|
| +diff -rpu unpatched_ffmpeg-mt/libavformat/oggdec.c ffmpeg-mt/libavformat/oggdec.c
|
| +--- unpatched_ffmpeg-mt/libavformat/oggdec.c 2010-03-11 17:46:31 -0800
|
| ++++ ffmpeg-mt/libavformat/oggdec.c 2010-03-11 19:12:46 -0800
|
| +@@ -38,13 +38,23 @@
|
| + #define DECODER_BUFFER_SIZE MAX_PAGE_SIZE
|
| +
|
| + static const struct ogg_codec * const ogg_codecs[] = {
|
| ++#if CONFIG_DIRAC_DEMUXER
|
| + &ff_dirac_codec,
|
| ++#endif
|
| ++#if CONFIG_LIBSPEEX
|
| + &ff_speex_codec,
|
| ++#endif
|
| + &ff_vorbis_codec,
|
| + &ff_theora_codec,
|
| ++#if CONFIG_FLAC_DECODER
|
| + &ff_flac_codec,
|
| ++#endif
|
| ++#if CONFIG_DIRAC_DEMUXER
|
| + &ff_old_dirac_codec,
|
| ++#endif
|
| ++#if CONFIG_FLAC_DECODER
|
| + &ff_old_flac_codec,
|
| ++#endif
|
| + &ff_ogm_video_codec,
|
| + &ff_ogm_audio_codec,
|
| + &ff_ogm_text_codec,
|
| +@@ -200,7 +210,7 @@ ogg_new_buf(struct ogg *ogg, int idx)
|
| + }
|
| +
|
| + static int
|
| +-ogg_read_page (AVFormatContext * s, int *str)
|
| ++ogg_read_page (AVFormatContext * s, int *str, int64_t *offset)
|
| + {
|
| + ByteIOContext *bc = s->pb;
|
| + struct ogg *ogg = s->priv_data;
|
| +@@ -214,6 +224,7 @@ ogg_read_page (AVFormatContext * s, int
|
| + int size, idx;
|
| + uint8_t sync[4];
|
| + int sp = 0;
|
| ++ int64_t poffset = url_ftell(bc);
|
| +
|
| + if (get_buffer (bc, sync, 4) < 4)
|
| + return -1;
|
| +@@ -298,18 +309,22 @@ ogg_read_page (AVFormatContext * s, int
|
| +
|
| + if (str)
|
| + *str = idx;
|
| ++ if (offset)
|
| ++ *offset = poffset;
|
| +
|
| + return 0;
|
| + }
|
| +
|
| + static int
|
| +-ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize)
|
| ++ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize, int64_t* offset)
|
| + {
|
| + struct ogg *ogg = s->priv_data;
|
| + int idx, i;
|
| + struct ogg_stream *os;
|
| + int complete = 0;
|
| + int segp = 0, psize = 0;
|
| ++ int64_t poffset;
|
| ++ int pnum = 0;
|
| +
|
| + #if 0
|
| + av_log (s, AV_LOG_DEBUG, "ogg_packet: curidx=%i\n", ogg->curidx);
|
| +@@ -319,10 +334,13 @@ ogg_packet (AVFormatContext * s, int *st
|
| + idx = ogg->curidx;
|
| +
|
| + while (idx < 0){
|
| +- if (ogg_read_page (s, &idx) < 0)
|
| ++ if (ogg_read_page (s, &idx, &poffset) < 0)
|
| + return -1;
|
| + }
|
| +
|
| ++ if (pnum++ == 0 && offset)
|
| ++ *offset = poffset;
|
| ++
|
| + os = ogg->streams + idx;
|
| +
|
| + #if 0
|
| +@@ -418,12 +436,15 @@ static int
|
| + ogg_get_headers (AVFormatContext * s)
|
| + {
|
| + struct ogg *ogg = s->priv_data;
|
| ++ int64_t pos = 0;
|
| +
|
| + do{
|
| +- if (ogg_packet (s, NULL, NULL, NULL) < 0)
|
| ++ if (ogg_packet (s, NULL, NULL, NULL, &pos) < 0)
|
| + return -1;
|
| + }while (!ogg->headers);
|
| +
|
| ++ s->data_offset = pos;
|
| ++
|
| + #if 0
|
| + av_log (s, AV_LOG_DEBUG, "found headers\n");
|
| + #endif
|
| +@@ -472,7 +493,7 @@ ogg_get_length (AVFormatContext * s)
|
| + ogg_save (s);
|
| + url_fseek (s->pb, end, SEEK_SET);
|
| +
|
| +- while (!ogg_read_page (s, &i)){
|
| ++ while (!ogg_read_page (s, &i, NULL)){
|
| + if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 &&
|
| + ogg->streams[i].codec)
|
| + idx = i;
|
| +@@ -523,7 +544,7 @@ ogg_read_packet (AVFormatContext * s, AV
|
| +
|
| + //Get an ogg packet
|
| + do{
|
| +- if (ogg_packet (s, &idx, &pstart, &psize) < 0)
|
| ++ if (ogg_packet (s, &idx, &pstart, &psize, NULL) < 0)
|
| + return AVERROR(EIO);
|
| + }while (idx < 0 || !s->streams[idx]);
|
| +
|
| +@@ -585,14 +606,17 @@ ogg_read_timestamp (AVFormatContext * s,
|
| + ByteIOContext *bc = s->pb;
|
| + int64_t pts = AV_NOPTS_VALUE;
|
| + int i;
|
| ++ int64_t fpoffset = AV_NOPTS_VALUE;
|
| ++ int64_t poffset;
|
| + url_fseek(bc, *pos_arg, SEEK_SET);
|
| +- while (url_ftell(bc) < pos_limit && !ogg_read_page (s, &i)) {
|
| ++ while (url_ftell(bc) < pos_limit && !ogg_read_page (s, &i, &poffset)) {
|
| ++ if (fpoffset == AV_NOPTS_VALUE && i == stream_index)
|
| ++ fpoffset = poffset;
|
| + if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 &&
|
| + ogg->streams[i].codec && i == stream_index) {
|
| + pts = ogg_gptopts(s, i, ogg->streams[i].granule, NULL);
|
| +- // FIXME: this is the position of the packet after the one with above
|
| +- // pts.
|
| +- *pos_arg = url_ftell(bc);
|
| ++ *pos_arg = fpoffset;
|
| ++ url_fseek(bc, fpoffset, SEEK_SET);
|
| + break;
|
| + }
|
| + }
|
| +Only in ffmpeg-mt/libavformat: oggdec.c~
|
|
|