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
This commit is contained in:
4
bmp.c
4
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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user