diff mbox series

[FFmpeg-devel,01/12] avcodec/vorbisenc: Remove always-false check

Message ID 20210325154956.2405162-1-andreas.rheinhardt@gmail.com
State Accepted
Commit e4ccd348c15d30d24e1270b4cd3455c7ebaeb229
Headers show
Series [FFmpeg-devel,01/12] avcodec/vorbisenc: Remove always-false check
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt March 25, 2021, 3:49 p.m. UTC
The PutBitContext is big enough: It has just been initialized to 8192B.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/vorbisenc.c | 5 -----
 1 file changed, 5 deletions(-)

Comments

Andreas Rheinhardt March 28, 2021, 3:39 p.m. UTC | #1
On Thu, Mar 25, 2021 at 4:50 PM Andreas Rheinhardt <
andreas.rheinhardt@gmail.com> wrote:

> The PutBitContext is big enough: It has just been initialized to 8192B.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/vorbisenc.c | 5 -----
>  1 file changed, 5 deletions(-)
>
> diff --git a/libavcodec/vorbisenc.c b/libavcodec/vorbisenc.c
> index 18a679f2dc..f8a08f816f 100644
> --- a/libavcodec/vorbisenc.c
> +++ b/libavcodec/vorbisenc.c
> @@ -1135,11 +1135,6 @@ static int vorbis_encode_frame(AVCodecContext
> *avctx, AVPacket *avpkt,
>
>      init_put_bits(&pb, avpkt->data, avpkt->size);
>
> -    if (pb.size_in_bits - put_bits_count(&pb) < 1 + ilog(venc->nmodes -
> 1)) {
> -        av_log(avctx, AV_LOG_ERROR, "output buffer is too small\n");
> -        return AVERROR(EINVAL);
> -    }
> -
>      put_bits(&pb, 1, 0); // magic bit
>
>      put_bits(&pb, ilog(venc->nmodes - 1), 1); // Mode for current frame
> --
> 2.27.0
>
>
Ping. WIll apply this patchset tomorrow unless there are objections.

- Andreas
diff mbox series

Patch

diff --git a/libavcodec/vorbisenc.c b/libavcodec/vorbisenc.c
index 18a679f2dc..f8a08f816f 100644
--- a/libavcodec/vorbisenc.c
+++ b/libavcodec/vorbisenc.c
@@ -1135,11 +1135,6 @@  static int vorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
 
     init_put_bits(&pb, avpkt->data, avpkt->size);
 
-    if (pb.size_in_bits - put_bits_count(&pb) < 1 + ilog(venc->nmodes - 1)) {
-        av_log(avctx, AV_LOG_ERROR, "output buffer is too small\n");
-        return AVERROR(EINVAL);
-    }
-
     put_bits(&pb, 1, 0); // magic bit
 
     put_bits(&pb, ilog(venc->nmodes - 1), 1); // Mode for current frame