[FFmpeg-cvslog] Fix buffer_size argument to init_put_bits() in multiple encoders.

Dyami Caliri git at videolan.org
Thu Mar 12 00:52:55 CET 2015


ffmpeg | branch: release/0.7 | Dyami Caliri <dyami at dragonframe.com> | Thu Feb 26 10:17:01 2015 -0800| [c681f86a324d6181c31006edb300356af47e91cd] | committer: Michael Niedermayer

Fix buffer_size argument to init_put_bits() in multiple encoders.

Several encoders were multiplying the buffer size by 8, in order to get
a bit size. However, the buffer_size argument is for the byte size of
the buffer. We had experienced crashes encoding prores (Anatoliy) at
size 4096x4096.
(cherry picked from commit 50833c9f7b4e1922197a8955669f8ab3589c8cef)

Conflicts:

	libavcodec/proresenc_kostya.c

Conflicts:

	libavcodec/faxcompr.c
	libavcodec/s302menc.c

Conflicts:

	libavcodec/adpcmenc.c

Conflicts:

	libavcodec/adpcmenc.c
	libavcodec/proresenc.c

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c681f86a324d6181c31006edb300356af47e91cd
---

 libavcodec/aacenc.c        |    2 +-
 libavcodec/faxcompr.c      |    2 +-
 libavcodec/flashsv2enc.c   |    2 +-
 libavcodec/flashsvenc.c    |    2 +-
 libavcodec/nellymoserenc.c |    2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 0de6622..68fa0aa 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -153,7 +153,7 @@ static void put_audio_specific_config(AVCodecContext *avctx)
     PutBitContext pb;
     AACEncContext *s = avctx->priv_data;
 
-    init_put_bits(&pb, avctx->extradata, avctx->extradata_size*8);
+    init_put_bits(&pb, avctx->extradata, avctx->extradata_size);
     put_bits(&pb, 5, 2); //object type - AAC-LC
     put_bits(&pb, 4, s->samplerate_index); //sample rate index
     put_bits(&pb, 4, avctx->channels);
diff --git a/libavcodec/faxcompr.c b/libavcodec/faxcompr.c
index 34aa576..0995811 100644
--- a/libavcodec/faxcompr.c
+++ b/libavcodec/faxcompr.c
@@ -243,7 +243,7 @@ static void put_line(uint8_t *dst, int size, int width, const int *runs)
     PutBitContext pb;
     int run, mode = ~0, pix_left = width, run_idx = 0;
 
-    init_put_bits(&pb, dst, size*8);
+    init_put_bits(&pb, dst, size);
     while(pix_left > 0){
         run = runs[run_idx++];
         mode = ~mode;
diff --git a/libavcodec/flashsv2enc.c b/libavcodec/flashsv2enc.c
index 7ee299c..86a35b6 100644
--- a/libavcodec/flashsv2enc.c
+++ b/libavcodec/flashsv2enc.c
@@ -270,7 +270,7 @@ static int write_header(FlashSV2Context * s, uint8_t * buf, int buf_size)
     if (buf_size < 5)
         return -1;
 
-    init_put_bits(&pb, buf, buf_size * 8);
+    init_put_bits(&pb, buf, buf_size);
 
     put_bits(&pb, 4, (s->block_width  >> 4) - 1);
     put_bits(&pb, 12, s->image_width);
diff --git a/libavcodec/flashsvenc.c b/libavcodec/flashsvenc.c
index c0327a9..8a813f2 100644
--- a/libavcodec/flashsvenc.c
+++ b/libavcodec/flashsvenc.c
@@ -139,7 +139,7 @@ static int encode_bitstream(FlashSVContext *s, AVFrame *p, uint8_t *buf,
     int buf_pos, res;
     int pred_blocks = 0;
 
-    init_put_bits(&pb, buf, buf_size * 8);
+    init_put_bits(&pb, buf, buf_size);
 
     put_bits(&pb,  4, (block_width / 16) - 1);
     put_bits(&pb, 12, s->image_width);
diff --git a/libavcodec/nellymoserenc.c b/libavcodec/nellymoserenc.c
index 1d35cda..f32b5b2 100644
--- a/libavcodec/nellymoserenc.c
+++ b/libavcodec/nellymoserenc.c
@@ -287,7 +287,7 @@ static void encode_block(NellyMoserEncodeContext *s, unsigned char *output, int
 
     apply_mdct(s);
 
-    init_put_bits(&pb, output, output_size * 8);
+    init_put_bits(&pb, output, output_size);
 
     i = 0;
     for (band = 0; band < NELLY_BANDS; band++) {



More information about the ffmpeg-cvslog mailing list