From 8e11a05bd61a3ca7c4b8d35488c70cd53a314ca5 Mon Sep 17 00:00:00 2001 From: DRC Date: Tue, 18 Oct 2011 22:07:13 +0000 Subject: [PATCH] Make sure we don't call jpeg_destroy_[de]compress() on an uninitialized struct, as bad mojo can ensue. git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@714 632fc199-4ca6-4c93-a231-07263d6284db --- bmp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bmp.c b/bmp.c index 82b2966e..4caefb41 100644 --- a/bmp.c +++ b/bmp.c @@ -107,6 +107,8 @@ int loadbmp(char *filename, unsigned char **buf, int *w, int *h, cjpeg_source_ptr src; FILE *file=NULL; + memset(&cinfo, 0, sizeof(struct jpeg_compress_struct)); + if(!filename || !buf || !w || !h || dstpf<0 || dstpf>=TJ_NUMPF) _throw("loadbmp(): Invalid argument"); @@ -189,6 +191,8 @@ int savebmp(char *filename, unsigned char *buf, int w, int h, int srcpf, FILE *file=NULL; char *ptr=NULL; + memset(&dinfo, 0, sizeof(struct jpeg_decompress_struct)); + if(!filename || !buf || w<1 || h<1 || srcpf<0 || srcpf>=TJ_NUMPF) _throw("savebmp(): Invalid argument");