summaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-03-09 01:22:31 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-03-09 01:22:31 +0100
commita8cedbebf163ad376abc4703b3156c44d0858404 (patch)
tree7198ad7a96b58d3ea53b2208601b707da2db3c00 /libavformat
parenta4524930d9299dbb8fafe165105d83bf7b6d3b89 (diff)
parentea1d64ab1066145ba919b79a2080f3091d562217 (diff)
downloadffmpeg-streaming-a8cedbebf163ad376abc4703b3156c44d0858404.zip
ffmpeg-streaming-a8cedbebf163ad376abc4703b3156c44d0858404.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: ttadec: unbreak playback of matroska files vorbisdec: avoid invalid memory access Fix uninitialized reads on malformed ogg files. huffyuv: add padding to classic (v1) huffman tables. png: convert to bytestream2 API. dca: include libavutil/mathematics.h for possibly missing M_SQRT1_2 avs: fix infinite loop on end-of-stream. tiffdec: Prevent illegal memory access caused by recycled pointers. rtpenc: Fix the AVRational used for av_rescale_q_rnd wma: fix off-by-one in array bounds check. Conflicts: libavcodec/huffyuv.c libavcodec/pngdec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/oggdec.c10
-rw-r--r--libavformat/rtpenc.c2
2 files changed, 6 insertions, 6 deletions
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index 39f99e5..bdd2c5b 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -69,8 +69,7 @@ static int ogg_save(AVFormatContext *s)
for (i = 0; i < ogg->nstreams; i++){
struct ogg_stream *os = ogg->streams + i;
- os->buf = av_malloc (os->bufsize);
- memset (os->buf, 0, os->bufsize);
+ os->buf = av_mallocz (os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE);
memcpy (os->buf, ost->streams[i].buf, os->bufpos);
}
@@ -167,7 +166,7 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial, int new_avstream)
os = ogg->streams + idx;
os->serial = serial;
os->bufsize = DECODER_BUFFER_SIZE;
- os->buf = av_malloc(os->bufsize);
+ os->buf = av_malloc(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE);
os->header = -1;
if (new_avstream) {
@@ -185,7 +184,7 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial, int new_avstream)
static int ogg_new_buf(struct ogg *ogg, int idx)
{
struct ogg_stream *os = ogg->streams + idx;
- uint8_t *nb = av_malloc(os->bufsize);
+ uint8_t *nb = av_malloc(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE);
int size = os->bufpos - os->pstart;
if(os->buf){
memcpy(nb, os->buf + os->pstart, size);
@@ -299,7 +298,7 @@ static int ogg_read_page(AVFormatContext *s, int *str)
}
if (os->bufsize - os->bufpos < size){
- uint8_t *nb = av_malloc (os->bufsize *= 2);
+ uint8_t *nb = av_malloc ((os->bufsize *= 2) + FF_INPUT_BUFFER_PADDING_SIZE);
memcpy (nb, os->buf, os->bufpos);
av_free (os->buf);
os->buf = nb;
@@ -313,6 +312,7 @@ static int ogg_read_page(AVFormatContext *s, int *str)
os->granule = gp;
os->flags = flags;
+ memset(os->buf + os->bufpos, 0, FF_INPUT_BUFFER_PADDING_SIZE);
if (str)
*str = idx;
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index 1e1dac5..6c1029b 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -138,7 +138,7 @@ static int rtp_write_header(AVFormatContext *s1)
s->max_frames_per_packet =
av_rescale_q_rnd(s1->max_delay,
AV_TIME_BASE_Q,
- (AVRational){ frame_size / st->codec->sample_rate },
+ (AVRational){ frame_size, st->codec->sample_rate },
AV_ROUND_DOWN);
}
}
OpenPOWER on IntegriCloud