diff options
| author | Mathieu Malaterre <mathieu.malaterre@gmail.com> | 2014-03-25 11:47:34 +0000 |
|---|---|---|
| committer | Mathieu Malaterre <mathieu.malaterre@gmail.com> | 2014-03-25 11:47:34 +0000 |
| commit | 18d5d25cb6609bfa79aaf7864856033bc508a7b2 (patch) | |
| tree | 6f473ebc277153d10a0b856d145d79cf93f6d6b6 /src | |
| parent | 492d8ab7d9dbe9b850cf8c7a9930189a1e864c66 (diff) | |
[trunk] Make sure to not use alpha pointer if it is not an RGBA input
Fixes issue 310
Diffstat (limited to 'src')
| -rw-r--r-- | src/bin/jp2/convert.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/bin/jp2/convert.c b/src/bin/jp2/convert.c index e5a8b0bb..d3e9773c 100644 --- a/src/bin/jp2/convert.c +++ b/src/bin/jp2/convert.c @@ -3222,7 +3222,7 @@ opj_image_t *pngtoimage(const char *read_idf, opj_cparameters_t * params) opj_image_cmptparm_t cmptparm[4]; int sub_dx, sub_dy; unsigned int nr_comp; - int *r, *g, *b, *a; + int *r, *g, *b, *a = NULL; unsigned char sigbuf[8]; if((reader = fopen(read_idf, "rb")) == NULL) @@ -3312,7 +3312,7 @@ opj_image_t *pngtoimage(const char *read_idf, opj_cparameters_t * params) png_read_image(png, rows); - memset(&cmptparm, 0, 4 * sizeof(opj_image_cmptparm_t)); + memset(cmptparm, 0, sizeof(cmptparm)); sub_dx = params->subsampling_dx; sub_dy = params->subsampling_dy; @@ -3340,7 +3340,7 @@ opj_image_t *pngtoimage(const char *read_idf, opj_cparameters_t * params) r = image->comps[0].data; g = image->comps[1].data; b = image->comps[2].data; - a = image->comps[3].data; + if(has_alpha) a = image->comps[3].data; for(i = 0; i < height; ++i) { |
