diff mbox

[FFmpeg-devel,4/7] xfacedec: Fix possible overread

Message ID 20171017221159.2349-4-sw@jkqxz.net
State Accepted
Commit 8c9fff618382bd19388f24558ff5c2fd10d85768
Headers show

Commit Message

Mark Thompson Oct. 17, 2017, 10:11 p.m. UTC
Fixes #6745.
---
 libavcodec/xfacedec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Oct. 19, 2017, 12:54 a.m. UTC | #1
On Tue, Oct 17, 2017 at 11:11:56PM +0100, Mark Thompson wrote:
> Fixes #6745.
> ---
>  libavcodec/xfacedec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

this should not be needed, AVPacket.data should have padding at the end
but also shouldnt do any harm


[...]
diff mbox

Patch

diff --git a/libavcodec/xfacedec.c b/libavcodec/xfacedec.c
index d045cb6ef4..ab4c0823f5 100644
--- a/libavcodec/xfacedec.c
+++ b/libavcodec/xfacedec.c
@@ -123,7 +123,7 @@  static int xface_decode_frame(AVCodecContext *avctx,
     if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
         return ret;
 
-    for (i = 0, k = 0; avpkt->data[i] && i < avpkt->size; i++) {
+    for (i = 0, k = 0; i < avpkt->size && avpkt->data[i]; i++) {
         c = avpkt->data[i];
 
         /* ignore invalid digits */