Fix potential out-of-bounds read (coverity) (#844)
[openjpeg.git] / src / lib / openjp3d / jp3d.c
index 1b940e70b0a806000e44e21447cd494493e0e446..9e060df741ae35e1e04a6e23d55fbce8ca17f2d2 100644 (file)
@@ -1,4 +1,9 @@
 /*
+ * The copyright in this software is being made available under the 2-clauses 
+ * BSD License, included below. This software may be subject to other third 
+ * party and contributor rights, including patent rights, and no such rights
+ * are granted under this license.
+ *
  * Copyright (c) 2001-2003, David Janssens
  * Copyright (c) 2002-2003, Yannick Verschueren
  * Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
@@ -1003,6 +1008,7 @@ static void j3d_write_qcx(opj_j3d_t *j3d, int compno) {
        
        cio_write(cio, tccp->qntsty + (tccp->numgbits << 5), 1);        /* Sqcx : Table A28 de 15444-1*/
        
+       numbands = 0; // compiler warning
        if (j3d->cinfo->codec_format == CODEC_J2K)
         numbands = tccp->qntsty == J3D_CCP_QNTSTY_SIQNT ? 1 : tccp->numresolution[0] * 3 - 2; 
        else if (j3d->cinfo->codec_format == CODEC_J3D) {