qrencode-4.1.1-12.fc44

List of Findings

Error: COMPILER_WARNING: [#def1]
qrencode-4.1.1/qrenc.c: scope_hint: In function ‘writeANSI.isra.0’
qrencode-4.1.1/qrenc.c:795:17: warning[-Wstringop-truncation]: ‘__strncpy_chk’ output may be truncated copying between 5 and 11 bytes from a string of length 11
#  795 |                 strncpy(buffer, white, (size_t)white_s);
#      |                 ^
#  793|   
#  794|   		memset(buffer, 0, (size_t)buffer_s);
#  795|-> 		strncpy(buffer, white, (size_t)white_s);
#  796|   		for(x = 0; x < margin; x++ ){
#  797|   			strncat(buffer, "  ", 2);

Error: COMPILER_WARNING: [#def2]
qrencode-4.1.1/qrenc.c:797:25: warning[-Wstringop-overflow=]: ‘strncat’ specified bound 2 equals source length
#  795|   		strncpy(buffer, white, (size_t)white_s);
#  796|   		for(x = 0; x < margin; x++ ){
#  797|-> 			strncat(buffer, "  ", 2);
#  798|   		}
#  799|   		last = 0;

Error: COMPILER_WARNING: [#def3]
qrencode-4.1.1/qrenc.c:804:41: warning[-Wstringop-truncation]: ‘__strncat_chk’ output may be truncated copying between 5 and 10 bytes from a string of length 10
#  804 |                                         strncat(buffer, black, (size_t)black_s);
#      |                                         ^
#  802|   			if(*(row+x)&0x1) {
#  803|   				if( last != 1 ){
#  804|-> 					strncat(buffer, black, (size_t)black_s);
#  805|   					last = 1;
#  806|   				}

Error: COMPILER_WARNING: [#def4]
qrencode-4.1.1/qrenc.c:808:33: warning[-Wstringop-truncation]: ‘__strncat_chk’ output may be truncated copying between 5 and 11 bytes from a string of length 11
#  808 |                                 strncat(buffer, white, (size_t)white_s);
#      |                                 ^
#  806|   				}
#  807|   			} else if( last != 0 ){
#  808|-> 				strncat(buffer, white, (size_t)white_s);
#  809|   				last = 0;
#  810|   			}

Error: COMPILER_WARNING: [#def5]
qrencode-4.1.1/qrenc.c:811:25: warning[-Wstringop-overflow=]: ‘strncat’ specified bound 2 equals source length
#  809|   				last = 0;
#  810|   			}
#  811|-> 			strncat(buffer, "  ", 2);
#  812|   		}
#  813|   

Error: COMPILER_WARNING: [#def6]
qrencode-4.1.1/qrenc.c:815:25: warning[-Wstringop-truncation]: ‘__strncat_chk’ output may be truncated copying between 5 and 11 bytes from a string of length 11
#  815 |                         strncat(buffer, white, (size_t)white_s);
#      |                         ^
#  813|   
#  814|   		if( last != 0 ){
#  815|-> 			strncat(buffer, white, (size_t)white_s);
#  816|   		}
#  817|   		for(x = 0; x < margin; x++ ){

Error: COMPILER_WARNING: [#def7]
qrencode-4.1.1/qrenc.c:818:25: warning[-Wstringop-overflow=]: ‘strncat’ specified bound 2 equals source length
#  816|   		}
#  817|   		for(x = 0; x < margin; x++ ){
#  818|-> 			strncat(buffer, "  ", 2);
#  819|   		}
#  820|   		strncat(buffer, "\033[0m\n", 5);

Error: COMPILER_WARNING: [#def8]
qrencode-4.1.1/qrenc.c:820:17: warning[-Wstringop-overflow=]: ‘strncat’ specified bound 5 equals source length
#  818|   			strncat(buffer, "  ", 2);
#  819|   		}
#  820|-> 		strncat(buffer, "\033[0m\n", 5);
#  821|   		fputs(buffer, fp);
#  822|   	}

Error: CPPCHECK_WARNING (CWE-476): [#def9]
qrencode-4.1.1/qrencode.c:499: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: masked
#  497|   	if(mask == -2) { // just for debug purpose
#  498|   		masked = (unsigned char *)malloc((size_t)(width * width));
#  499|-> 		memcpy(masked, frame, (size_t)(width * width));
#  500|   	} else if(mask < 0) {
#  501|   		masked = Mask_mask(width, frame, input->level);

Error: CPPCHECK_WARNING (CWE-476): [#def10]
qrencode-4.1.1/qrencode.c:586: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: masked
#  584|   	if(mask == -2) { // just for debug purpose
#  585|   		masked = (unsigned char *)malloc((size_t)(width * width));
#  586|-> 		memcpy(masked, frame, (size_t)(width * width));
#  587|   	} else if(mask < 0) {
#  588|   		masked = MMask_mask(version, frame, input->level);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def11]
qrencode-4.1.1/qrencode.c:586:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘masked’ where non-null expected
qrencode-4.1.1/qrencode.c:519:27: enter_function: entry to ‘QRcode_encodeMaskMQR’
qrencode-4.1.1/qrencode.c:541:15: call_function: calling ‘MQRraw_new’ from ‘QRcode_encodeMaskMQR’
qrencode-4.1.1/qrencode.c:541:15: return_function: returning to ‘QRcode_encodeMaskMQR’ from ‘MQRraw_new’
qrencode-4.1.1/qrencode.c:542:11: branch_false: following ‘false’ branch...
qrencode-4.1.1/qrencode.c:544:9: branch_false: ...to here
qrencode-4.1.1/qrencode.c:547:11: branch_false: following ‘false’ branch...
qrencode-4.1.1/qrencode.c:551:9: call_function: inlined call to ‘FrameFiller_set’ from ‘QRcode_encodeMaskMQR’
qrencode-4.1.1/qrencode.c:569:20: branch_false: following ‘false’ branch...
qrencode-4.1.1/qrencode.c:580:9: branch_false: ...to here
qrencode-4.1.1/qrencode.c:580:9: call_function: calling ‘MQRraw_free’ from ‘QRcode_encodeMaskMQR’
qrencode-4.1.1/qrencode.c:580:9: return_function: returning to ‘QRcode_encodeMaskMQR’ from ‘MQRraw_free’
qrencode-4.1.1/qrencode.c:584:11: branch_true: following ‘true’ branch (when ‘mask == -2’)...
qrencode-4.1.1/qrencode.c:585:58: branch_true: ...to here
qrencode-4.1.1/qrencode.c:585:43: acquire_memory: this call could return NULL
qrencode-4.1.1/qrencode.c:586:17: danger: argument 1 (‘masked’) from [(27)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/26) could be NULL where non-null expected
#  584|   	if(mask == -2) { // just for debug purpose
#  585|   		masked = (unsigned char *)malloc((size_t)(width * width));
#  586|-> 		memcpy(masked, frame, (size_t)(width * width));
#  587|   	} else if(mask < 0) {
#  588|   		masked = MMask_mask(version, frame, input->level);

Error: CPPCHECK_WARNING (CWE-476): [#def12]
qrencode-4.1.1/tests/datachunk.c:103: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: outbuf
#  101|   	*outp = '\0';
#  102|   
#  103|-> 	printf("%s\n", outbuf);
#  104|   
#  105|   	iconv_close(conv);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def13]
qrencode-4.1.1/tests/datachunk.c:166:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘data’ where non-null expected
qrencode-4.1.1/tests/datachunk.c:161:11: branch_false: following ‘false’ branch (when ‘size > 0’)...
qrencode-4.1.1/tests/datachunk.c:163:40: branch_false: ...to here
qrencode-4.1.1/tests/datachunk.c:163:33: acquire_memory: this call could return NULL
qrencode-4.1.1/tests/datachunk.c:165:15: branch_true: following ‘true’ branch (when ‘list’ is non-NULL)...
qrencode-4.1.1/tests/datachunk.c:166:48: branch_true: ...to here
qrencode-4.1.1/tests/datachunk.c:166:17: danger: argument 1 (‘data + (sizetype)idx’) from [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2) could be NULL where non-null expected
#  164|   	idx = 0;
#  165|   	while(list != NULL) {
#  166|-> 		memcpy(&data[idx], list->data, list->size);
#  167|   		idx += list->size;
#  168|   		list = list->next;

Error: CPPCHECK_WARNING (CWE-476): [#def14]
qrencode-4.1.1/tests/datachunk.c:170: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: data
#  168|   		list = list->next;
#  169|   	}
#  170|-> 	data[size] = '\0';
#  171|   
#  172|   	*retsize = size;

Error: CPPCHECK_WARNING (CWE-476): [#def15]
qrencode-4.1.1/tests/decoder.c:99: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buf
#   97|   		sprintf(q, "%1d", val);
#   98|   	}
#   99|-> 	buf[size] = '\0';
#  100|   
#  101|   	chunk = DataChunk_new(QR_MODE_NUM);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def16]
qrencode-4.1.1/tests/decoder.c:559:12: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘filler’
qrencode-4.1.1/tests/decoder.c:915:9: enter_function: entry to ‘QRcode_decodeBitsMQR’
qrencode-4.1.1/tests/decoder.c:922:19: call_function: calling ‘QRcode_extractBitsMQR’ from ‘QRcode_decodeBitsMQR’
#  557|   	int x, y, w;
#  558|   
#  559|-> 	if(filler->bit == -1) {
#  560|   		filler->bit = 0;
#  561|   		return filler->frame + filler->y * filler->width + filler->x;

Error: CPPCHECK_WARNING (CWE-682): [#def17]
qrencode-4.1.1/tests/decoder.c:638: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
#  636|   		row = i % blocks + ((col >= d1)?b1:0);
#  637|   		idx = d1 * row + col + ((row > b1)?(row-b1):0);
#  638|-> 		q = bits + idx * 8;
#  639|   		for(j=0; j<8; j++) {
#  640|   			p = FrameFiller_next(filler);

Error: CPPCHECK_WARNING (CWE-476): [#def18]
qrencode-4.1.1/tests/decoder.c:839: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: bits
#  837|   	filler = FrameFiller_new(width, frame, 1);
#  838|   	for(i=0; i<size; i++) {
#  839|-> 		bits[i] = *(FrameFiller_next(filler)) & 1;
#  840|   	}
#  841|   	free(filler);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def19]
qrencode-4.1.1/tests/decoder.c:839:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘bits’
qrencode-4.1.1/tests/decoder.c:915:9: enter_function: entry to ‘QRcode_decodeBitsMQR’
qrencode-4.1.1/tests/decoder.c:922:19: call_function: calling ‘QRcode_extractBitsMQR’ from ‘QRcode_decodeBitsMQR’
#  837|   	filler = FrameFiller_new(width, frame, 1);
#  838|   	for(i=0; i<size; i++) {
#  839|-> 		bits[i] = *(FrameFiller_next(filler)) & 1;
#  840|   	}
#  841|   	free(filler);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def20]
qrencode-4.1.1/tests/decoder.c:839:27: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
qrencode-4.1.1/tests/decoder.c:915:9: enter_function: entry to ‘QRcode_decodeBitsMQR’
qrencode-4.1.1/tests/decoder.c:922:19: call_function: calling ‘QRcode_extractBitsMQR’ from ‘QRcode_decodeBitsMQR’
#  837|   	filler = FrameFiller_new(width, frame, 1);
#  838|   	for(i=0; i<size; i++) {
#  839|-> 		bits[i] = *(FrameFiller_next(filler)) & 1;
#  840|   	}
#  841|   	free(filler);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def21]
qrencode-4.1.1/tests/decoder.c:928:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘QRdata_newMQR()’
qrencode-4.1.1/tests/decoder.c:915:9: enter_function: entry to ‘QRcode_decodeBitsMQR’
qrencode-4.1.1/tests/decoder.c:922:19: call_function: calling ‘QRcode_extractBitsMQR’ from ‘QRcode_decodeBitsMQR’
qrencode-4.1.1/tests/decoder.c:922:19: return_function: returning to ‘QRcode_decodeBitsMQR’ from ‘QRcode_extractBitsMQR’
qrencode-4.1.1/tests/decoder.c:923:11: branch_false: following ‘false’ branch...
qrencode-4.1.1/tests/decoder.c:927:18: branch_false: ...to here
qrencode-4.1.1/tests/decoder.c:927:18: call_function: calling ‘QRdata_newMQR’ from ‘QRcode_decodeBitsMQR’
qrencode-4.1.1/tests/decoder.c:927:18: return_function: returning to ‘QRcode_decodeBitsMQR’ from ‘QRdata_newMQR’
qrencode-4.1.1/tests/decoder.c:928:9: danger: dereference of NULL ‘QRdata_newMQR()’
#  926|   
#  927|   	qrdata = QRdata_newMQR();
#  928|-> 	qrdata->version = version;
#  929|   	qrdata->level = level;
#  930|   	ret = QRdata_decodeBits(qrdata, dataLength, bstream->data);

Error: CPPCHECK_WARNING (CWE-476): [#def22]
qrencode-4.1.1/tests/test_estimatebit.c:50: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: num
#   48|   	stream = QRinput_new();
#   49|   	num = (char *)malloc(401);
#   50|-> 	memset(num, '1', 400);
#   51|   	num[400] = '\0';
#   52|   	QRinput_append(stream, QR_MODE_NUM, 400, (unsigned char *)num);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def23]
qrencode-4.1.1/tests/test_estimatebit.c:50:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘num’ where non-null expected
qrencode-4.1.1/tests/test_estimatebit.c:49:23: acquire_memory: this call could return NULL
qrencode-4.1.1/tests/test_estimatebit.c:50:9: danger: argument 1 (‘num’) from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
#   48|   	stream = QRinput_new();
#   49|   	num = (char *)malloc(401);
#   50|-> 	memset(num, '1', 400);
#   51|   	num[400] = '\0';
#   52|   	QRinput_append(stream, QR_MODE_NUM, 400, (unsigned char *)num);

Error: CPPCHECK_WARNING (CWE-476): [#def24]
qrencode-4.1.1/tests/test_estimatebit.c:51: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: num
#   49|   	num = (char *)malloc(401);
#   50|   	memset(num, '1', 400);
#   51|-> 	num[400] = '\0';
#   52|   	QRinput_append(stream, QR_MODE_NUM, 400, (unsigned char *)num);
#   53|   	bits = QRinput_estimateBitStreamSize(stream, 0);

Error: CPPCHECK_WARNING (CWE-476): [#def25]
qrencode-4.1.1/tests/test_mask.c:150: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: frame
#  148|   
#  149|   	testStart("Test mask evaluation (all white)");
#  150|-> 	memset(frame, 0, w * w);
#  151|   	demerit = Mask_evaluateSymbol(w, frame);
#  152|   	testEndExp(demerit == ((N1 + 1)*w*2 + N2 * (w - 1) * (w - 1)));

Error: GCC_ANALYZER_WARNING (CWE-688): [#def26]
qrencode-4.1.1/tests/test_mask.c:150:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘frame’ where non-null expected
qrencode-4.1.1/tests/test_mask.c:147:34: acquire_memory: this call could return NULL
qrencode-4.1.1/tests/test_mask.c:150:9: danger: argument 1 (‘frame’) from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
#  148|   
#  149|   	testStart("Test mask evaluation (all white)");
#  150|-> 	memset(frame, 0, w * w);
#  151|   	demerit = Mask_evaluateSymbol(w, frame);
#  152|   	testEndExp(demerit == ((N1 + 1)*w*2 + N2 * (w - 1) * (w - 1)));

Error: CPPCHECK_WARNING (CWE-476): [#def27]
qrencode-4.1.1/tests/test_mask.c:155: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: frame
#  153|   
#  154|   	testStart("Test mask evaluation (all black)");
#  155|-> 	memset(frame, 1, w * w);
#  156|   	demerit = Mask_evaluateSymbol(w, frame);
#  157|   	testEndExp(demerit == ((N1 + 1)*w*2 + N2 * (w - 1) * (w - 1)));

Error: CPPCHECK_WARNING (CWE-476): [#def28]
qrencode-4.1.1/tests/test_mask.c:184: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: frame
#  182|   	testStart("Test mask evaluation (run length penalty check)");
#  183|   	for(x=0; x<w; x++) {
#  184|-> 		frame[      x] = x & 1;
#  185|   		frame[w   + x] = (x & 1) ^ 1;
#  186|   		frame[w*2 + x] = (x / 2) & 1;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def29]
qrencode-4.1.1/tests/test_mask.c:184:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘frame’
qrencode-4.1.1/tests/test_mask.c:180:34: acquire_memory: this call could return NULL
qrencode-4.1.1/tests/test_mask.c:183:18: branch_true: following ‘true’ branch (when ‘x != 10’)...
qrencode-4.1.1/tests/test_mask.c:184:34: branch_true: ...to here
qrencode-4.1.1/tests/test_mask.c:184:17: danger: ‘frame + (sizetype)x’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  182|   	testStart("Test mask evaluation (run length penalty check)");
#  183|   	for(x=0; x<w; x++) {
#  184|-> 		frame[      x] = x & 1;
#  185|   		frame[w   + x] = (x & 1) ^ 1;
#  186|   		frame[w*2 + x] = (x / 2) & 1;

Error: CPPCHECK_WARNING (CWE-476): [#def30]
qrencode-4.1.1/tests/test_mask.c:185: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: frame
#  183|   	for(x=0; x<w; x++) {
#  184|   		frame[      x] = x & 1;
#  185|-> 		frame[w   + x] = (x & 1) ^ 1;
#  186|   		frame[w*2 + x] = (x / 2) & 1;
#  187|   		frame[w*3 + x] = ((x / 2) & 1) ^ 1;

Error: CPPCHECK_WARNING (CWE-476): [#def31]
qrencode-4.1.1/tests/test_mask.c:186: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: frame
#  184|   		frame[      x] = x & 1;
#  185|   		frame[w   + x] = (x & 1) ^ 1;
#  186|-> 		frame[w*2 + x] = (x / 2) & 1;
#  187|   		frame[w*3 + x] = ((x / 2) & 1) ^ 1;
#  188|   		frame[w*4 + x] = (x / 3) & 1;

Error: CPPCHECK_WARNING (CWE-476): [#def32]
qrencode-4.1.1/tests/test_mask.c:187: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: frame
#  185|   		frame[w   + x] = (x & 1) ^ 1;
#  186|   		frame[w*2 + x] = (x / 2) & 1;
#  187|-> 		frame[w*3 + x] = ((x / 2) & 1) ^ 1;
#  188|   		frame[w*4 + x] = (x / 3) & 1;
#  189|   		frame[w*5 + x] = ((x / 3) & 1) ^ 1;

Error: CPPCHECK_WARNING (CWE-476): [#def33]
qrencode-4.1.1/tests/test_mask.c:188: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: frame
#  186|   		frame[w*2 + x] = (x / 2) & 1;
#  187|   		frame[w*3 + x] = ((x / 2) & 1) ^ 1;
#  188|-> 		frame[w*4 + x] = (x / 3) & 1;
#  189|   		frame[w*5 + x] = ((x / 3) & 1) ^ 1;
#  190|   		frame[w*6 + x] = (x / 4) & 1;

Error: CPPCHECK_WARNING (CWE-476): [#def34]
qrencode-4.1.1/tests/test_mask.c:189: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: frame
#  187|   		frame[w*3 + x] = ((x / 2) & 1) ^ 1;
#  188|   		frame[w*4 + x] = (x / 3) & 1;
#  189|-> 		frame[w*5 + x] = ((x / 3) & 1) ^ 1;
#  190|   		frame[w*6 + x] = (x / 4) & 1;
#  191|   		frame[w*7 + x] = ((x / 4) & 1) ^ 1;

Error: CPPCHECK_WARNING (CWE-476): [#def35]
qrencode-4.1.1/tests/test_mask.c:190: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: frame
#  188|   		frame[w*4 + x] = (x / 3) & 1;
#  189|   		frame[w*5 + x] = ((x / 3) & 1) ^ 1;
#  190|-> 		frame[w*6 + x] = (x / 4) & 1;
#  191|   		frame[w*7 + x] = ((x / 4) & 1) ^ 1;
#  192|   		frame[w*8 + x] = (x / 5) & 1;

Error: CPPCHECK_WARNING (CWE-476): [#def36]
qrencode-4.1.1/tests/test_mask.c:191: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: frame
#  189|   		frame[w*5 + x] = ((x / 3) & 1) ^ 1;
#  190|   		frame[w*6 + x] = (x / 4) & 1;
#  191|-> 		frame[w*7 + x] = ((x / 4) & 1) ^ 1;
#  192|   		frame[w*8 + x] = (x / 5) & 1;
#  193|   		frame[w*9 + x] = ((x / 5) & 1) ^ 1;

Error: CPPCHECK_WARNING (CWE-476): [#def37]
qrencode-4.1.1/tests/test_mask.c:192: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: frame
#  190|   		frame[w*6 + x] = (x / 4) & 1;
#  191|   		frame[w*7 + x] = ((x / 4) & 1) ^ 1;
#  192|-> 		frame[w*8 + x] = (x / 5) & 1;
#  193|   		frame[w*9 + x] = ((x / 5) & 1) ^ 1;
#  194|   	}

Error: CPPCHECK_WARNING (CWE-476): [#def38]
qrencode-4.1.1/tests/test_mask.c:193: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: frame
#  191|   		frame[w*7 + x] = ((x / 4) & 1) ^ 1;
#  192|   		frame[w*8 + x] = (x / 5) & 1;
#  193|-> 		frame[w*9 + x] = ((x / 5) & 1) ^ 1;
#  194|   	}
#  195|   	demerit = Mask_evaluateSymbol(w, frame);

Error: CPPCHECK_WARNING (CWE-476): [#def39]
qrencode-4.1.1/tests/test_mask.c:261: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: frame
#  259|   	for(y=0; y<5; y++) {
#  260|   		for(x=0; x<w; x++) {
#  261|-> 			frame[w*y*2     + x] = pattern[y][x];
#  262|   			frame[w*(y*2+1) + x] = pattern[y][x]^1;
#  263|   		}

Error: GCC_ANALYZER_WARNING (CWE-476): [#def40]
qrencode-4.1.1/tests/test_mask.c:261:25: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘frame’
qrencode-4.1.1/tests/test_mask.c:255:34: acquire_memory: this call could return NULL
qrencode-4.1.1/tests/test_mask.c:259:18: branch_true: following ‘true’ branch (when ‘y != 5’)...
qrencode-4.1.1/tests/test_mask.c:259:18: branch_true: ...to here
qrencode-4.1.1/tests/test_mask.c:260:26: branch_true: following ‘true’ branch (when ‘x != 15’)...
qrencode-4.1.1/tests/test_mask.c:261:31: branch_true: ...to here
qrencode-4.1.1/tests/test_mask.c:261:25: danger: ‘frame + (sizetype)(y * 30 + x)’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#  259|   	for(y=0; y<5; y++) {
#  260|   		for(x=0; x<w; x++) {
#  261|-> 			frame[w*y*2     + x] = pattern[y][x];
#  262|   			frame[w*(y*2+1) + x] = pattern[y][x]^1;
#  263|   		}

Error: CPPCHECK_WARNING (CWE-476): [#def41]
qrencode-4.1.1/tests/test_mask.c:262: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: frame
#  260|   		for(x=0; x<w; x++) {
#  261|   			frame[w*y*2     + x] = pattern[y][x];
#  262|-> 			frame[w*(y*2+1) + x] = pattern[y][x]^1;
#  263|   		}
#  264|   	}

Error: CPPCHECK_WARNING (CWE-476): [#def42]
qrencode-4.1.1/tests/test_mask.c:266: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: frame
#  264|   	}
#  265|   	for(x=0; x<w; x++) {
#  266|-> 		frame[w*10 + x] = x & 1;
#  267|   	}
#  268|   	for(y=5; y<7; y++) {

Error: CPPCHECK_WARNING (CWE-476): [#def43]
qrencode-4.1.1/tests/test_monkey.c:105: warning[nullPointerOutOfResources]: If resource allocation fails, then there is a possible null pointer dereference: fp
#  103|   		snprintf(buf, 256, "monkey-orig-%d.dat", num);
#  104|   		fp = fopen(buf, "w");
#  105|-> 		fputs((char *)data, fp);
#  106|   		fclose(fp);
#  107|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def44]
qrencode-4.1.1/tests/test_monkey.c:105:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fopen(&buf, "w")’ where non-null expected
qrencode-4.1.1/tests/test_monkey.c:185:13: enter_function: entry to ‘monkey_encode_an’
qrencode-4.1.1/tests/test_monkey.c:191:18: branch_true: following ‘true’ branch (when ‘i < loop’)...
qrencode-4.1.1/tests/test_monkey.c:192:17: branch_true: ...to here
qrencode-4.1.1/tests/test_monkey.c:192:17: call_function: calling ‘test_encode_an’ from ‘monkey_encode_an’
#  103|   		snprintf(buf, 256, "monkey-orig-%d.dat", num);
#  104|   		fp = fopen(buf, "w");
#  105|-> 		fputs((char *)data, fp);
#  106|   		fclose(fp);
#  107|   

Error: CPPCHECK_WARNING (CWE-476): [#def45]
qrencode-4.1.1/tests/test_monkey.c:110: warning[nullPointerOutOfResources]: If resource allocation fails, then there is a possible null pointer dereference: fp
#  108|   		snprintf(buf, 256, "monkey-result-%d.dat", num);
#  109|   		fp = fopen(buf, "w");
#  110|-> 		fputs((char *)qrdata->data, fp);
#  111|   		fclose(fp);
#  112|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def46]
qrencode-4.1.1/tests/test_monkey.c:110:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fopen(&buf, "w")’ where non-null expected
qrencode-4.1.1/tests/test_monkey.c:185:13: enter_function: entry to ‘monkey_encode_an’
qrencode-4.1.1/tests/test_monkey.c:191:18: branch_true: following ‘true’ branch (when ‘i < loop’)...
qrencode-4.1.1/tests/test_monkey.c:192:17: branch_true: ...to here
qrencode-4.1.1/tests/test_monkey.c:192:17: call_function: calling ‘test_encode_an’ from ‘monkey_encode_an’
#  108|   		snprintf(buf, 256, "monkey-result-%d.dat", num);
#  109|   		fp = fopen(buf, "w");
#  110|-> 		fputs((char *)qrdata->data, fp);
#  111|   		fclose(fp);
#  112|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def47]
qrencode-4.1.1/tests/test_monkey.c:119:33: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fopen(&buf, "w")’ where non-null expected
qrencode-4.1.1/tests/test_monkey.c:185:13: enter_function: entry to ‘monkey_encode_an’
qrencode-4.1.1/tests/test_monkey.c:191:18: branch_true: following ‘true’ branch (when ‘i < loop’)...
qrencode-4.1.1/tests/test_monkey.c:192:17: branch_true: ...to here
qrencode-4.1.1/tests/test_monkey.c:192:17: call_function: calling ‘test_encode_an’ from ‘monkey_encode_an’
#  117|   		for(y=0; y<qrcode->width; y++) {
#  118|   			for(x=0; x<qrcode->width; x++) {
#  119|-> 				fputc((*p&1)?'1':'0', fp);
#  120|   				p++;
#  121|   			}

Error: CPPCHECK_WARNING (CWE-476): [#def48]
qrencode-4.1.1/tests/test_monkey.c:124: warning[nullPointerOutOfResources]: If resource allocation fails, then there is a possible null pointer dereference: fp
#  122|   			fputc('\n', fp);
#  123|   		}
#  124|-> 		fclose(fp);
#  125|   		free(frame);
#  126|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def49]
qrencode-4.1.1/tests/test_monkey.c:124:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fopen(&buf, "w")’ where non-null expected
qrencode-4.1.1/tests/test_monkey.c:185:13: enter_function: entry to ‘monkey_encode_an’
qrencode-4.1.1/tests/test_monkey.c:191:18: branch_true: following ‘true’ branch (when ‘i < loop’)...
qrencode-4.1.1/tests/test_monkey.c:192:17: branch_true: ...to here
qrencode-4.1.1/tests/test_monkey.c:192:17: call_function: calling ‘test_encode_an’ from ‘monkey_encode_an’
#  122|   			fputc('\n', fp);
#  123|   		}
#  124|-> 		fclose(fp);
#  125|   		free(frame);
#  126|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def50]
qrencode-4.1.1/tests/test_monkey.c:135:33: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fopen(&buf, "w")’ where non-null expected
qrencode-4.1.1/tests/test_monkey.c:185:13: enter_function: entry to ‘monkey_encode_an’
qrencode-4.1.1/tests/test_monkey.c:191:18: branch_true: following ‘true’ branch (when ‘i < loop’)...
qrencode-4.1.1/tests/test_monkey.c:192:17: branch_true: ...to here
qrencode-4.1.1/tests/test_monkey.c:192:17: call_function: calling ‘test_encode_an’ from ‘monkey_encode_an’
#  133|   		for(y=0; y<origcode->width; y++) {
#  134|   			for(x=0; x<origcode->width; x++) {
#  135|-> 				fputc((*p&1)?'1':'0', fp);
#  136|   				p++;
#  137|   			}

Error: CPPCHECK_WARNING (CWE-476): [#def51]
qrencode-4.1.1/tests/test_monkey.c:140: warning[nullPointerOutOfResources]: If resource allocation fails, then there is a possible null pointer dereference: fp
#  138|   			fputc('\n', fp);
#  139|   		}
#  140|-> 		fclose(fp);
#  141|   		QRcode_free(origcode);
#  142|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def52]
qrencode-4.1.1/tests/test_monkey.c:140:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fopen(&buf, "w")’ where non-null expected
qrencode-4.1.1/tests/test_monkey.c:185:13: enter_function: entry to ‘monkey_encode_an’
qrencode-4.1.1/tests/test_monkey.c:191:18: branch_true: following ‘true’ branch (when ‘i < loop’)...
qrencode-4.1.1/tests/test_monkey.c:192:17: branch_true: ...to here
qrencode-4.1.1/tests/test_monkey.c:192:17: call_function: calling ‘test_encode_an’ from ‘monkey_encode_an’
#  138|   			fputc('\n', fp);
#  139|   		}
#  140|-> 		fclose(fp);
#  141|   		QRcode_free(origcode);
#  142|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def53]
qrencode-4.1.1/tests/test_monkey.c:149:25: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fopen(&buf, "w")’ where non-null expected
qrencode-4.1.1/tests/test_monkey.c:185:13: enter_function: entry to ‘monkey_encode_an’
qrencode-4.1.1/tests/test_monkey.c:191:18: branch_true: following ‘true’ branch (when ‘i < loop’)...
qrencode-4.1.1/tests/test_monkey.c:192:17: branch_true: ...to here
qrencode-4.1.1/tests/test_monkey.c:192:17: call_function: calling ‘test_encode_an’ from ‘monkey_encode_an’
#  147|   		c = 0;
#  148|   		for(x=0; x<bstream->length; x++) {
#  149|-> 			fputc((bstream->data[x]&1)?'1':'0', fp);
#  150|   			if((x & 7) == 7) {
#  151|   				fputc(' ', fp);

Error: CPPCHECK_WARNING (CWE-476): [#def54]
qrencode-4.1.1/tests/test_monkey.c:158: warning[nullPointerOutOfResources]: If resource allocation fails, then there is a possible null pointer dereference: fp
#  156|   			}
#  157|   		}
#  158|-> 		fclose(fp);
#  159|   		QRinput_free(input);
#  160|   		BitStream_free(bstream);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def55]
qrencode-4.1.1/tests/test_monkey.c:158:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fopen(&buf, "w")’ where non-null expected
qrencode-4.1.1/tests/test_monkey.c:185:13: enter_function: entry to ‘monkey_encode_an’
qrencode-4.1.1/tests/test_monkey.c:191:18: branch_true: following ‘true’ branch (when ‘i < loop’)...
qrencode-4.1.1/tests/test_monkey.c:192:17: branch_true: ...to here
qrencode-4.1.1/tests/test_monkey.c:192:17: call_function: calling ‘test_encode_an’ from ‘monkey_encode_an’
#  156|   			}
#  157|   		}
#  158|-> 		fclose(fp);
#  159|   		QRinput_free(input);
#  160|   		BitStream_free(bstream);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def56]
qrencode-4.1.1/tests/test_monkey.c:169:25: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fopen(&buf, "w")’ where non-null expected
qrencode-4.1.1/tests/test_monkey.c:185:13: enter_function: entry to ‘monkey_encode_an’
qrencode-4.1.1/tests/test_monkey.c:191:18: branch_true: following ‘true’ branch (when ‘i < loop’)...
qrencode-4.1.1/tests/test_monkey.c:192:17: branch_true: ...to here
qrencode-4.1.1/tests/test_monkey.c:192:17: call_function: calling ‘test_encode_an’ from ‘monkey_encode_an’
#  167|   		c = 0;
#  168|   		for(x=0; x<y; x++) {
#  169|-> 			fputc((p[x]&1)?'1':'0', fp);
#  170|   			if((x & 7) == 7) {
#  171|   				fputc(' ', fp);

Error: CPPCHECK_WARNING (CWE-476): [#def57]
qrencode-4.1.1/tests/test_monkey.c:178: warning[nullPointerOutOfResources]: If resource allocation fails, then there is a possible null pointer dereference: fp
#  176|   			}
#  177|   		}
#  178|-> 		fclose(fp);
#  179|   		BitStream_free(bstream);
#  180|   	}

Error: GCC_ANALYZER_WARNING (CWE-688): [#def58]
qrencode-4.1.1/tests/test_monkey.c:178:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fopen(&buf, "w")’ where non-null expected
qrencode-4.1.1/tests/test_monkey.c:185:13: enter_function: entry to ‘monkey_encode_an’
qrencode-4.1.1/tests/test_monkey.c:191:18: branch_true: following ‘true’ branch (when ‘i < loop’)...
qrencode-4.1.1/tests/test_monkey.c:192:17: branch_true: ...to here
qrencode-4.1.1/tests/test_monkey.c:192:17: call_function: calling ‘test_encode_an’ from ‘monkey_encode_an’
#  176|   			}
#  177|   		}
#  178|-> 		fclose(fp);
#  179|   		BitStream_free(bstream);
#  180|   	}

Error: COMPILER_WARNING: [#def59]
qrencode-4.1.1/tests/test_monkey.c: scope_hint: In function ‘test_split_structure’
qrencode-4.1.1/tests/test_monkey.c:481:16: warning[-Wunused-but-set-variable=]: variable ‘i’ set but not used
#  481 |         int c, i, ret;
#      |                ^
#  479|   	int version;
#  480|   	QRecLevel level;
#  481|-> 	int c, i, ret;
#  482|   
#  483|   	version = (int)drand(40) + 1;

Error: CPPCHECK_WARNING (CWE-476): [#def60]
qrencode-4.1.1/tests/test_qrinput.c:129: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: str
#  127|   	testStart("Encoding 8bit stream. (auto-version up test)");
#  128|   	str = (char *)malloc(2900);
#  129|-> 	memset(str, 0xff, 2900);
#  130|   	stream = QRinput_new();
#  131|   	bstream = BitStream_new();

Error: GCC_ANALYZER_WARNING (CWE-688): [#def61]
qrencode-4.1.1/tests/test_qrinput.c:129:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘str’ where non-null expected
qrencode-4.1.1/tests/test_qrinput.c:128:23: acquire_memory: this call could return NULL
qrencode-4.1.1/tests/test_qrinput.c:129:9: danger: argument 1 (‘str’) from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
#  127|   	testStart("Encoding 8bit stream. (auto-version up test)");
#  128|   	str = (char *)malloc(2900);
#  129|-> 	memset(str, 0xff, 2900);
#  130|   	stream = QRinput_new();
#  131|   	bstream = BitStream_new();

Error: CPPCHECK_WARNING (CWE-476): [#def62]
qrencode-4.1.1/tests/test_qrinput.c:182: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: str
#  180|   	testStart("Encoding numeric stream. (auto-version up test)");
#  181|   	str = (char *)malloc(1050);
#  182|-> 	memset(str, '1', 1050);
#  183|   	stream = QRinput_new2(0, QR_ECLEVEL_L);
#  184|   	bstream = BitStream_new();

Error: GCC_ANALYZER_WARNING (CWE-688): [#def63]
qrencode-4.1.1/tests/test_qrinput.c:182:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘str’ where non-null expected
qrencode-4.1.1/tests/test_qrinput.c:181:23: acquire_memory: this call could return NULL
qrencode-4.1.1/tests/test_qrinput.c:182:9: danger: argument 1 (‘str’) from [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
#  180|   	testStart("Encoding numeric stream. (auto-version up test)");
#  181|   	str = (char *)malloc(1050);
#  182|-> 	memset(str, '1', 1050);
#  183|   	stream = QRinput_new2(0, QR_ECLEVEL_L);
#  184|   	bstream = BitStream_new();

Error: CPPCHECK_WARNING (CWE-476): [#def64]
qrencode-4.1.1/tests/test_qrinput.c:204: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: correct
#  202|   	testStart("Encoding numeric stream. (8 digits)(padded)");
#  203|   	correct = (char *)malloc(19 * 8 + 1);
#  204|-> 	correct[0] = '\0';
#  205|   	strcat(correct, correctHead);
#  206|   	for(i=0; i<13; i++) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def65]
qrencode-4.1.1/tests/test_qrinput.c:204:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘correct’
qrencode-4.1.1/tests/test_qrinput.c:203:27: acquire_memory: this call could return NULL
qrencode-4.1.1/tests/test_qrinput.c:204:9: danger: ‘correct’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#  202|   	testStart("Encoding numeric stream. (8 digits)(padded)");
#  203|   	correct = (char *)malloc(19 * 8 + 1);
#  204|-> 	correct[0] = '\0';
#  205|   	strcat(correct, correctHead);
#  206|   	for(i=0; i<13; i++) {

Error: CPPCHECK_WARNING (CWE-476): [#def66]
qrencode-4.1.1/tests/test_qrinput.c:205: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: correct
#  203|   	correct = (char *)malloc(19 * 8 + 1);
#  204|   	correct[0] = '\0';
#  205|-> 	strcat(correct, correctHead);
#  206|   	for(i=0; i<13; i++) {
#  207|   		strcat(correct, (i&1)?"00010001":"11101100");

Error: CPPCHECK_WARNING (CWE-476): [#def67]
qrencode-4.1.1/tests/test_qrinput.c:224: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: correct
#  222|   	testStart("Encoding numeric stream. (7 digits)(padded)");
#  223|   	correct = (char *)malloc(19 * 8 + 1);
#  224|-> 	correct[0] = '\0';
#  225|   	strcat(correct, correctHead);
#  226|   	for(i=0; i<13; i++) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def68]
qrencode-4.1.1/tests/test_qrinput.c:224:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘correct’
qrencode-4.1.1/tests/test_qrinput.c:223:27: acquire_memory: this call could return NULL
qrencode-4.1.1/tests/test_qrinput.c:224:9: danger: ‘correct’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0)
#  222|   	testStart("Encoding numeric stream. (7 digits)(padded)");
#  223|   	correct = (char *)malloc(19 * 8 + 1);
#  224|-> 	correct[0] = '\0';
#  225|   	strcat(correct, correctHead);
#  226|   	for(i=0; i<13; i++) {

Error: CPPCHECK_WARNING (CWE-476): [#def69]
qrencode-4.1.1/tests/test_qrinput.c:225: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: correct
#  223|   	correct = (char *)malloc(19 * 8 + 1);
#  224|   	correct[0] = '\0';
#  225|-> 	strcat(correct, correctHead);
#  226|   	for(i=0; i<13; i++) {
#  227|   		strcat(correct, (i&1)?"00010001":"11101100");

Error: CPPCHECK_WARNING (CWE-476): [#def70]
qrencode-4.1.1/tests/test_qrinput.c:492: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: data
#  490|   	data = (char *)malloc(8000);
#  491|   	for(i=0; i<8000; i++) {
#  492|-> 		data[i] = '0' + i % 10;
#  493|   	}
#  494|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def71]
qrencode-4.1.1/tests/test_qrinput.c:492:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘data’
qrencode-4.1.1/tests/test_qrinput.c:490:24: acquire_memory: this call could return NULL
qrencode-4.1.1/tests/test_qrinput.c:491:18: branch_true: following ‘true’ branch (when ‘i != 8000’)...
qrencode-4.1.1/tests/test_qrinput.c:492:33: branch_true: ...to here
qrencode-4.1.1/tests/test_qrinput.c:492:17: danger: ‘data + (sizetype)i’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/0)
#  490|   	data = (char *)malloc(8000);
#  491|   	for(i=0; i<8000; i++) {
#  492|-> 		data[i] = '0' + i % 10;
#  493|   	}
#  494|   

Error: CPPCHECK_WARNING (CWE-476): [#def72]
qrencode-4.1.1/tests/test_qrinput.c:565: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: str
#  563|   	testStart("Testing structured-append symbols. (too large data)");
#  564|   	str = (char *)malloc(128);
#  565|-> 	memset(str, 'a', 128);
#  566|   	input = QRinput_new2(1, QR_ECLEVEL_H);
#  567|   	QRinput_append(input, QR_MODE_8, 128, (unsigned char *)str);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def73]
qrencode-4.1.1/tests/test_qrinput.c:565:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘str’ where non-null expected
qrencode-4.1.1/tests/test_qrinput.c:564:23: acquire_memory: this call could return NULL
qrencode-4.1.1/tests/test_qrinput.c:565:9: danger: argument 1 (‘str’) from [(1)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
#  563|   	testStart("Testing structured-append symbols. (too large data)");
#  564|   	str = (char *)malloc(128);
#  565|-> 	memset(str, 'a', 128);
#  566|   	input = QRinput_new2(1, QR_ECLEVEL_H);
#  567|   	QRinput_append(input, QR_MODE_8, 128, (unsigned char *)str);

Error: CPPCHECK_WARNING (CWE-476): [#def74]
qrencode-4.1.1/tests/test_qrinput.c:587: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: str
#  585|   	testStart("Testing structured-append symbols. (invalid version 0)");
#  586|   	str = (char *)malloc(128);
#  587|-> 	memset(str, 'a', 128);
#  588|   	input = QRinput_new2(0, QR_ECLEVEL_H);
#  589|   	QRinput_append(input, QR_MODE_8, 128, (unsigned char *)str);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def75]
qrencode-4.1.1/tests/test_qrinput.c:587:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘str’ where non-null expected
qrencode-4.1.1/tests/test_qrinput.c:586:23: acquire_memory: this call could return NULL
qrencode-4.1.1/tests/test_qrinput.c:587:9: danger: argument 1 (‘str’) from [(1)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
#  585|   	testStart("Testing structured-append symbols. (invalid version 0)");
#  586|   	str = (char *)malloc(128);
#  587|-> 	memset(str, 'a', 128);
#  588|   	input = QRinput_new2(0, QR_ECLEVEL_H);
#  589|   	QRinput_append(input, QR_MODE_8, 128, (unsigned char *)str);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def76]
qrencode-4.1.1/tests/test_qrinput.c:652:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘d1’ where non-null expected
qrencode-4.1.1/tests/test_qrinput.c:648:31: acquire_memory: this call could return NULL
qrencode-4.1.1/tests/test_qrinput.c:651:15: branch_true: following ‘true’ branch (when ‘e’ is non-NULL)...
qrencode-4.1.1/tests/test_qrinput.c:652:41: branch_true: ...to here
qrencode-4.1.1/tests/test_qrinput.c:652:17: danger: argument 1 (‘d1 + (sizetype)i’) from [(1)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
#  650|   	i = 0;
#  651|   	while(e != NULL) {
#  652|-> 		memcpy(&d1[i], e->data, e->size);
#  653|   		i += e->size;
#  654|   		e = e->next;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def77]
qrencode-4.1.1/tests/test_qrinput.c:660:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘d2’ where non-null expected
qrencode-4.1.1/tests/test_qrinput.c:651:15: branch_false: following ‘false’ branch (when ‘e’ is NULL)...
qrencode-4.1.1/tests/test_qrinput.c:656:31: branch_false: ...to here
qrencode-4.1.1/tests/test_qrinput.c:656:31: acquire_memory: this call could return NULL
qrencode-4.1.1/tests/test_qrinput.c:659:15: branch_true: following ‘true’ branch (when ‘e’ is non-NULL)...
qrencode-4.1.1/tests/test_qrinput.c:660:41: branch_true: ...to here
qrencode-4.1.1/tests/test_qrinput.c:660:17: danger: argument 1 (‘d2 + (sizetype)i’) from [(3)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/2) could be NULL where non-null expected
#  658|   	i = 0;
#  659|   	while(e != NULL) {
#  660|-> 		memcpy(&d2[i], e->data, e->size);
#  661|   		i += e->size;
#  662|   		e = e->next;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def78]
qrencode-4.1.1/tests/test_qrinput.c:668:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘d1’ where non-null expected
qrencode-4.1.1/tests/test_qrinput.c:648:31: acquire_memory: this call could return NULL
qrencode-4.1.1/tests/test_qrinput.c:651:15: branch_false: following ‘false’ branch (when ‘e’ is NULL)...
qrencode-4.1.1/tests/test_qrinput.c:656:31: branch_false: ...to here
qrencode-4.1.1/tests/test_qrinput.c:659:15: branch_false: following ‘false’ branch (when ‘e’ is NULL)...
qrencode-4.1.1/tests/test_qrinput.c:665:9: branch_false: ...to here
qrencode-4.1.1/tests/test_qrinput.c:668:9: danger: argument 1 (‘d1’) from [(1)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
#  666|   	assert_equal(i2->head->size, 4, "split failed (first half)");
#  667|   	assert_equal(i2->head->next->size, 6, "split failed(second half)");
#  668|-> 	assert_zero(memcmp(d1, d2, size1), "strings are different.");
#  669|   	QRinput_free(i1);
#  670|   	QRinput_free(i2);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def79]
qrencode-4.1.1/tests/test_qrinput.c:668:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘d2’ where non-null expected
qrencode-4.1.1/tests/test_qrinput.c:651:15: branch_false: following ‘false’ branch (when ‘e’ is NULL)...
qrencode-4.1.1/tests/test_qrinput.c:656:31: branch_false: ...to here
qrencode-4.1.1/tests/test_qrinput.c:656:31: acquire_memory: this call could return NULL
qrencode-4.1.1/tests/test_qrinput.c:659:15: branch_false: following ‘false’ branch (when ‘e’ is NULL)...
qrencode-4.1.1/tests/test_qrinput.c:665:9: branch_false: ...to here
qrencode-4.1.1/tests/test_qrinput.c:668:9: danger: argument 2 (‘d2’) from [(3)](sarif:/runs/0/results/10/codeFlows/0/threadFlows/0/locations/2) could be NULL where non-null expected
#  666|   	assert_equal(i2->head->size, 4, "split failed (first half)");
#  667|   	assert_equal(i2->head->next->size, 6, "split failed(second half)");
#  668|-> 	assert_zero(memcmp(d1, d2, size1), "strings are different.");
#  669|   	QRinput_free(i1);
#  670|   	QRinput_free(i2);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def80]
qrencode-4.1.1/tests/test_qrinput.c:710:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘d1’ where non-null expected
qrencode-4.1.1/tests/test_qrinput.c:706:31: acquire_memory: this call could return NULL
qrencode-4.1.1/tests/test_qrinput.c:709:15: branch_true: following ‘true’ branch (when ‘e’ is non-NULL)...
qrencode-4.1.1/tests/test_qrinput.c:710:41: branch_true: ...to here
qrencode-4.1.1/tests/test_qrinput.c:710:17: danger: argument 1 (‘d1 + (sizetype)i’) from [(1)](sarif:/runs/0/results/11/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
#  708|   	i = 0;
#  709|   	while(e != NULL) {
#  710|-> 		memcpy(&d1[i], e->data, e->size);
#  711|   		i += e->size;
#  712|   		e = e->next;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def81]
qrencode-4.1.1/tests/test_qrinput.c:718:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘d2’ where non-null expected
qrencode-4.1.1/tests/test_qrinput.c:709:15: branch_false: following ‘false’ branch (when ‘e’ is NULL)...
qrencode-4.1.1/tests/test_qrinput.c:714:31: branch_false: ...to here
qrencode-4.1.1/tests/test_qrinput.c:714:31: acquire_memory: this call could return NULL
qrencode-4.1.1/tests/test_qrinput.c:717:15: branch_true: following ‘true’ branch (when ‘e’ is non-NULL)...
qrencode-4.1.1/tests/test_qrinput.c:718:41: branch_true: ...to here
qrencode-4.1.1/tests/test_qrinput.c:718:17: danger: argument 1 (‘d2 + (sizetype)i’) from [(3)](sarif:/runs/0/results/12/codeFlows/0/threadFlows/0/locations/2) could be NULL where non-null expected
#  716|   	i = 0;
#  717|   	while(e != NULL) {
#  718|-> 		memcpy(&d2[i], e->data, e->size);
#  719|   		i += e->size;
#  720|   		e = e->next;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def82]
qrencode-4.1.1/tests/test_qrinput.c:726:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘d1’ where non-null expected
qrencode-4.1.1/tests/test_qrinput.c:706:31: acquire_memory: this call could return NULL
qrencode-4.1.1/tests/test_qrinput.c:709:15: branch_false: following ‘false’ branch (when ‘e’ is NULL)...
qrencode-4.1.1/tests/test_qrinput.c:714:31: branch_false: ...to here
qrencode-4.1.1/tests/test_qrinput.c:717:15: branch_false: following ‘false’ branch (when ‘e’ is NULL)...
qrencode-4.1.1/tests/test_qrinput.c:723:9: branch_false: ...to here
qrencode-4.1.1/tests/test_qrinput.c:726:9: danger: argument 1 (‘d1’) from [(1)](sarif:/runs/0/results/13/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
#  724|   	assert_equal(i2->head->size, 4, "split failed (first half)");
#  725|   	assert_equal(i2->head->next->size, 6, "split failed(second half)");
#  726|-> 	assert_zero(memcmp(d1, d2, size1), "strings are different.");
#  727|   	QRinput_free(i1);
#  728|   	QRinput_free(i2);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def83]
qrencode-4.1.1/tests/test_qrinput.c:726:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘d2’ where non-null expected
qrencode-4.1.1/tests/test_qrinput.c:709:15: branch_false: following ‘false’ branch (when ‘e’ is NULL)...
qrencode-4.1.1/tests/test_qrinput.c:714:31: branch_false: ...to here
qrencode-4.1.1/tests/test_qrinput.c:714:31: acquire_memory: this call could return NULL
qrencode-4.1.1/tests/test_qrinput.c:717:15: branch_false: following ‘false’ branch (when ‘e’ is NULL)...
qrencode-4.1.1/tests/test_qrinput.c:723:9: branch_false: ...to here
qrencode-4.1.1/tests/test_qrinput.c:726:9: danger: argument 2 (‘d2’) from [(3)](sarif:/runs/0/results/14/codeFlows/0/threadFlows/0/locations/2) could be NULL where non-null expected
#  724|   	assert_equal(i2->head->size, 4, "split failed (first half)");
#  725|   	assert_equal(i2->head->next->size, 6, "split failed(second half)");
#  726|-> 	assert_zero(memcmp(d1, d2, size1), "strings are different.");
#  727|   	QRinput_free(i1);
#  728|   	QRinput_free(i2);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def84]
qrencode-4.1.1/tests/test_qrspec.c:145:37: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen("./frame", "rb")’
qrencode-4.1.1/tests/test_qrspec.c:137:14: acquire_resource: opened here
qrencode-4.1.1/tests/test_qrspec.c:138:11: branch_false: following ‘false’ branch...
qrencode-4.1.1/tests/test_qrspec.c:138:11: branch_false: ...to here
qrencode-4.1.1/tests/test_qrspec.c:142:18: branch_true: following ‘true’ branch (when ‘i != 41’)...
qrencode-4.1.1/tests/test_qrspec.c:143:25: branch_true: ...to here
qrencode-4.1.1/tests/test_qrspec.c:145:37: danger: ‘fopen("./frame", "rb")’ leaks here; was opened at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  143|   		frame = QRspec_newFrame(i);
#  144|   		width = QRspec_getWidth(i);
#  145|-> 		len = fread(buf, 1, width * width, fp);
#  146|   		if((int)len != width * width) {
#  147|   			perror("Failed to read the pattern file:");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def85]
qrencode-4.1.1/tests/test_qrspec.c:145:37: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen("./frame", "rb")’
qrencode-4.1.1/tests/test_qrspec.c:137:14: acquire_memory: allocated here
qrencode-4.1.1/tests/test_qrspec.c:138:11: branch_false: following ‘false’ branch...
qrencode-4.1.1/tests/test_qrspec.c:138:11: branch_false: ...to here
qrencode-4.1.1/tests/test_qrspec.c:142:18: branch_true: following ‘true’ branch (when ‘i != 41’)...
qrencode-4.1.1/tests/test_qrspec.c:143:25: branch_true: ...to here
qrencode-4.1.1/tests/test_qrspec.c:145:37: danger: ‘fopen("./frame", "rb")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  143|   		frame = QRspec_newFrame(i);
#  144|   		width = QRspec_getWidth(i);
#  145|-> 		len = fread(buf, 1, width * width, fp);
#  146|   		if((int)len != width * width) {
#  147|   			perror("Failed to read the pattern file:");

Scan Properties

analyzer-version-clippy1.97.1
analyzer-version-cppcheck2.21.1
analyzer-version-gcc16.1.1
analyzer-version-gcc-analyzer16.1.1
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-163.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20260524.213755.g3c6d0be.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-nameqrencode-4.1.1-12.fc44
store-results-to/tmp/tmp8ndywlav/qrencode-4.1.1-12.fc44.tar.xz
time-created2026-08-03 20:17:07
time-finished2026-08-03 20:19:21
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,clippy,unicontrol,shellcheck,cppcheck' '-o' '/tmp/tmp8ndywlav/qrencode-4.1.1-12.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmp8ndywlav/qrencode-4.1.1-12.fc44.src.rpm'
tool-versioncsmock-3.8.7.20260803.142340.gb75b18e-1.el9