summaryrefslogtreecommitdiff
path: root/libavcodec/lcldec.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-05-31 10:42:26 +0000
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-05-31 10:42:26 +0000
commit0d48e6ec7f589c51ef883f8af66e15c5f1e4ff25 (patch)
tree5a32c29e3f82f06e4d9b4cbc694554b3456fe395 /libavcodec/lcldec.c
parent974ce7854423e8eaf4afe97fbec6114bc8c33a55 (diff)
Pad the decompression buffer and use av_memcpy_backptr for the mszh decompression.
Originally committed as revision 19054 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/lcldec.c')
-rw-r--r--libavcodec/lcldec.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c
index b662ddc347..927f77b30b 100644
--- a/libavcodec/lcldec.c
+++ b/libavcodec/lcldec.c
@@ -44,6 +44,7 @@
#include "avcodec.h"
#include "bytestream.h"
#include "lcl.h"
+#include "libavutil/lzo.h"
#if CONFIG_ZLIB_DECODER
#include <zlib.h>
@@ -73,6 +74,7 @@ typedef struct LclDecContext {
/**
* \param srcptr compressed source buffer, must be padded with at least 4 extra bytes
+ * \param destptr must be padded sufficiently for av_memcpy_backptr
*/
static unsigned int mszh_decomp(const unsigned char * srcptr, int srclen, unsigned char * destptr, unsigned int destsize)
{
@@ -103,10 +105,8 @@ static unsigned int mszh_decomp(const unsigned char * srcptr, int srclen, unsign
if (destptr_end - destptr < cnt) {
cnt = destptr_end - destptr;
}
- for (; cnt > 0; cnt--) {
- *destptr = *(destptr - ofs);
- destptr++;
- }
+ av_memcpy_backptr(destptr, ofs, cnt);
+ destptr += cnt;
}
}
@@ -445,7 +445,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
{
LclDecContext * const c = avctx->priv_data;
unsigned int basesize = avctx->width * avctx->height;
- unsigned int max_basesize = FFALIGN(avctx->width, 4) * FFALIGN(avctx->height, 4);
+ unsigned int max_basesize = FFALIGN(avctx->width, 4) * FFALIGN(avctx->height, 4) + AV_LZO_OUTPUT_PADDING;
unsigned int max_decomp_size;
c->pic.data[0] = NULL;