From 7bda392b5023205f3458577eb2da8a80fa0b8108 Mon Sep 17 00:00:00 2001 From: James Zern Date: Mon, 2 Jul 2012 14:02:01 -0700 Subject: [PATCH] cwebp: fix crash with yuv input + lossless Change-Id: Ia27c925f532a4243369288e954abdc063b9f94f9 --- examples/cwebp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/cwebp.c b/examples/cwebp.c index 35140ee5..3343e10b 100644 --- a/examples/cwebp.c +++ b/examples/cwebp.c @@ -64,11 +64,13 @@ extern void* VP8GetCPUInfo; // opaque forward declaration. static int verbose = 0; static int ReadYUV(FILE* in_file, WebPPicture* const pic) { + const int use_argb_input = pic->use_argb_input; const int uv_width = (pic->width + 1) / 2; const int uv_height = (pic->height + 1) / 2; int y; int ok = 0; + pic->use_argb_input = 0; if (!WebPPictureAlloc(pic)) return ok; for (y = 0; y < pic->height; ++y) { @@ -85,6 +87,7 @@ static int ReadYUV(FILE* in_file, WebPPicture* const pic) { goto End; } ok = 1; + if (use_argb_input) ok = WebPPictureYUVAToARGB(pic); End: return ok;