diff mbox

[FFmpeg-devel,2/2] avcodec/pixlet: Reorder rlen check

Message ID 20170408013445.5331-2-michael@niedermayer.cc
State Accepted
Commit c94d551ea7b39c4e467e146cd347c407e8eb38ee
Headers show

Commit Message

Michael Niedermayer April 8, 2017, 1:34 a.m. UTC
This changes nothing but is nicer looking as this checks rlen

Maybe this helps coverity remove CID1397743

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/pixlet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer April 10, 2017, 11:12 a.m. UTC | #1
On Sat, Apr 08, 2017 at 03:34:45AM +0200, Michael Niedermayer wrote:
> This changes nothing but is nicer looking as this checks rlen
> 
> Maybe this helps coverity remove CID1397743
> 
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/pixlet.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied

[...]
diff mbox

Patch

diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c
index 4aa59f8f33..c4f7597866 100644
--- a/libavcodec/pixlet.c
+++ b/libavcodec/pixlet.c
@@ -173,7 +173,7 @@  static int read_low_coeffs(AVCodecContext *avctx, int16_t *dst, int size, int wi
             }
         }
 
-        if (i + rlen > size)
+        if (rlen > size - i)
             return AVERROR_INVALIDDATA;
         i += rlen;