summaryrefslogtreecommitdiff
path: root/src/bin/jp2
diff options
context:
space:
mode:
authorMathieu Malaterre <mathieu.malaterre@gmail.com>2014-03-24 16:01:51 +0000
committerMathieu Malaterre <mathieu.malaterre@gmail.com>2014-03-24 16:01:51 +0000
commit18c5be69e9c2bd195e707a7ef7f1f6625b74a86b (patch)
treefaa41e976ab74ce518a97730ad42841917c379bd /src/bin/jp2
parent5a70e97f515a5cfbbc58e5f0580c731fb5eee677 (diff)
[trunk] Make sure to exit early instead of looping on every single pixels
Diffstat (limited to 'src/bin/jp2')
-rw-r--r--src/bin/jp2/convert.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/bin/jp2/convert.c b/src/bin/jp2/convert.c
index 2ab6d628..e5a8b0bb 100644
--- a/src/bin/jp2/convert.c
+++ b/src/bin/jp2/convert.c
@@ -1867,8 +1867,12 @@ opj_image_t* pnmtoimage(const char *filename, opj_cparameters_t *parameters) {
{
for(compno = 0; compno < numcomps; compno++)
{
- if ( !fread(&c0, 1, 1, fp) )
- fprintf(stderr, "\nError: fread return a number of element different from the expected.\n");
+ if ( !fread(&c0, 1, 1, fp) )
+ {
+ fprintf(stderr, "\nError: fread return a number of element different from the expected.\n");
+ opj_image_destroy(image);
+ return NULL;
+ }
if(one)
{
image->comps[compno].data[i] = c0;