Skip to content

Commit 36578c8

Browse files
committed
0.20221215: check return value jpeg_read_coefficients
1 parent cec7fa0 commit 36578c8

File tree

5 files changed

+8
-3
lines changed

5 files changed

+8
-3
lines changed

src/idct.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
#include "idct.h"
2525

26+
static JSAMPLE range_limit_static[11 * CENTERJSAMPLE];
27+
2628
void range_limit_init()
2729
{
2830
int i, c = CENTERJSAMPLE, m = c * 2;

src/idct.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ static const char jpeg_natural_order[DCTSIZE2] =
4343
53, 60, 61, 54, 47, 55, 62, 63
4444
};
4545

46-
static JSAMPLE range_limit_static[11 * CENTERJSAMPLE];
47-
4846
#define CONST_BITS 13
4947
#define PASS1_BITS 2
5048

src/jpegqs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ int main(int argc, char **argv)
147147

148148
(void) jpeg_read_header(&srcinfo, TRUE);
149149
src_coef_arrays = jpeg_read_coefficients(&srcinfo);
150+
if (src_coef_arrays == NULL) {
151+
logfmt("%s: can't read coefficients\n", progname);
152+
return 1;
153+
}
150154
logfmt("Options: border = %f, gain = %f, scale = %f, niter = %d\n", jqsparams.border, jqsparams.gain, jqsparams.scale, jqsparams.niter);
151155
do_quantsmooth(&srcinfo, src_coef_arrays, jqsparams);
152156

src/jpegqs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ static inline int64_t get_time_usec()
7979

8080
#include "idct.h"
8181

82-
static float ALIGN(32) quantsmooth_tables[DCTSIZE2][3*DCTSIZE2 + DCTSIZE];
8382
void quantsmooth_init(JQS_PARAMS jqsparams);
8483

8584
// When compiling with libjpeg-turbo and static linking, you can use

src/libjpegqs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#include "jpegqs.h"
2121

22+
static float ALIGN(32) quantsmooth_tables[DCTSIZE2][3*DCTSIZE2 + DCTSIZE];
23+
2224
void quantsmooth_init(JQS_PARAMS jqsparams)
2325
{
2426
int i, l0, l1, x, y, p0, p1;

0 commit comments

Comments
 (0)