diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2011-12-30 10:37:33 +0100 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2011-12-30 10:37:33 +0100 |
commit | 874da652b307fe0d2bec08fc5916a9a82537f40c (patch) | |
tree | 74a10d27d3f34e7ad2bc6ba00d77338283976f66 /libavutil/lzo.c | |
parent | b0143da80656f286b3e2363f3ddb6f81c4a0fbf5 (diff) | |
download | ffmpeg-874da652b307fe0d2bec08fc5916a9a82537f40c.tar.gz |
Avoid av_memcpy_backptr hang without extra branch.
This only happens for a "back" value of 0 which is invalid anyway,
but lcldec does not properly validate input.
Also extend the documentation to specify valid values.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Diffstat (limited to 'libavutil/lzo.c')
-rw-r--r-- | libavutil/lzo.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavutil/lzo.c b/libavutil/lzo.c index 0b9d2e42ba..3642308100 100644 --- a/libavutil/lzo.c +++ b/libavutil/lzo.c @@ -112,7 +112,7 @@ static inline void memcpy_backptr(uint8_t *dst, int back, int cnt); /** * @brief Copies previously decoded bytes to current position. - * @param back how many bytes back we start + * @param back how many bytes back we start, must be > 0 * @param cnt number of bytes to copy, must be >= 0 * * cnt > back is valid, this will copy the bytes we just copied, @@ -135,9 +135,9 @@ static inline void copy_backptr(LZOContext *c, int back, int cnt) { static inline void memcpy_backptr(uint8_t *dst, int back, int cnt) { const uint8_t *src = &dst[-back]; - if (back == 1) { + if (back <= 1) { memset(dst, *src, cnt); - } else if(back>0) { + } else { #ifdef OUTBUF_PADDED COPY2(dst, src); COPY2(dst + 2, src + 2); |