[SCM] libav/experimental: sgi: fix end of line boundary detection
siretart at users.alioth.debian.org
siretart at users.alioth.debian.org
Sun Aug 10 16:02:33 UTC 2014
The following commit has been merged in the experimental branch:
commit 0279d1d0946a854aa08919abd05b7f2da433823e
Author: Michael Niedermayer <michaelni at gmx.at>
Date: Sun Aug 12 05:32:07 2012 +0200
sgi: fix end of line boundary detection
diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c
index 91b68eb..112a181 100644
--- a/libavcodec/sgidec.c
+++ b/libavcodec/sgidec.c
@@ -48,13 +48,14 @@ static int expand_rle_row(SgiState *s, uint8_t *out_buf,
{
unsigned char pixel, count;
unsigned char *orig = out_buf;
+ uint8_t *out_end = out_buf + len;
- while (1) {
+ while (out_buf < out_end) {
if (bytestream2_get_bytes_left(&s->g) < 1)
return AVERROR_INVALIDDATA;
pixel = bytestream2_get_byteu(&s->g);
if (!(count = (pixel & 0x7f))) {
- return (out_buf - orig) / pixelstride;
+ break;
}
/* Check for buffer overflow. */
@@ -77,6 +78,7 @@ static int expand_rle_row(SgiState *s, uint8_t *out_buf,
}
}
}
+ return (out_buf - orig) / pixelstride;
}
/**
--
Libav/FFmpeg packaging
More information about the pkg-multimedia-commits
mailing list