aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMike Melanson <mike@multimedia.cx>2003-10-25 15:22:34 +0000
committerMike Melanson <mike@multimedia.cx>2003-10-25 15:22:34 +0000
commit94fd9201ad09d332ea06b6171f6b1e3b77ae701f (patch)
treea2465d44ff6c5cbace41d3d4059386d44f196ad9 /libavcodec
parent8dafdb88e668a5acf5007ca071c946afaa5060e6 (diff)
downloadffmpeg-94fd9201ad09d332ea06b6171f6b1e3b77ae701f.tar.gz
support Cinepak files with funky (not divisible by 4) resolutions
Originally committed as revision 2433 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/cinepak.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c
index c34a2d5ff3..af168d07b7 100644
--- a/libavcodec/cinepak.c
+++ b/libavcodec/cinepak.c
@@ -68,6 +68,8 @@ typedef struct CinepakContext {
unsigned char *data;
int size;
+ int width, height;
+
unsigned char palette[PALETTE_COUNT * 4];
int palette_video;
cvid_strip_t strips[MAX_STRIPS];
@@ -289,9 +291,9 @@ static int cinepak_decode_strip (CinepakContext *s,
int chunk_id, chunk_size;
/* coordinate sanity checks */
- if (strip->x1 >= s->avctx->width || strip->x2 > s->avctx->width ||
- strip->y1 >= s->avctx->height || strip->y2 > s->avctx->height ||
- strip->x1 >= strip->x2 || strip->y1 >= strip->y2)
+ if (strip->x1 >= s->width || strip->x2 > s->width ||
+ strip->y1 >= s->height || strip->y2 > s->height ||
+ strip->x1 >= strip->x2 || strip->y1 >= strip->y2)
return -1;
while ((data + 4) <= eod) {
@@ -390,6 +392,8 @@ static int cinepak_decode_init(AVCodecContext *avctx)
*/
s->avctx = avctx;
+ s->width = (avctx->width + 3) & ~3;
+ s->height = (avctx->height + 3) & ~3;
// check for paletted data
s->palette_video = 0;