Fixed findings

List of Findings

Error: CPPCHECK_WARNING (CWE-401): [#def1]
squashfs-tools-4.6.1/squashfs-tools/action.c:131: error[memleakOnRealloc]: Common realloc mistake: 'line' nulled but not freed upon failure
#  129|   
#  130|   			if(total + (MAX_LINE + 1) > size) {
#  131|-> 				line = realloc(line, size += (MAX_LINE + 1));
#  132|   				if(line == NULL)
#  133|   					MEM_ERROR();

Error: CPPCHECK_WARNING (CWE-476): [#def2]
squashfs-tools-4.6.1/squashfs-tools/action.c:404: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
#  402|   
#  403|   	if (test->args == -1) {
#  404|-> 		SYNTAX_ERROR("Non-existent test \"%s\"\n", name);
#  405|   		return NULL;
#  406|   	}

Error: CPPCHECK_WARNING (CWE-476): [#def3]
squashfs-tools-4.6.1/squashfs-tools/action.c:447: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
#  445|   	while(1) {
#  446|   		if (token != TOK_STRING) {
#  447|-> 			SYNTAX_ERROR("Unexpected token \"%s\", expected "
#  448|   				"argument\n", TOK_TO_STR(token, string));
#  449|   			goto failed;

Error: CPPCHECK_WARNING (CWE-401): [#def4]
squashfs-tools-4.6.1/squashfs-tools/action.c:452: error[memleakOnRealloc]: Common realloc mistake: 'argv' nulled but not freed upon failure
#  450|   		}
#  451|   
#  452|-> 		argv = realloc(argv, (args + 1) * sizeof(char *));
#  453|   		if (argv == NULL)
#  454|   			MEM_ERROR();

Error: CPPCHECK_WARNING (CWE-476): [#def5]
squashfs-tools-4.6.1/squashfs-tools/action.c:464: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
#  462|   
#  463|   		if (token != TOK_COMMA) {
#  464|-> 			SYNTAX_ERROR("Unexpected token \"%s\", expected "
#  465|   				"\",\" or \")\"\n", TOK_TO_STR(token, string));
#  466|   			goto failed;

Error: CPPCHECK_WARNING (CWE-476): [#def6]
squashfs-tools-4.6.1/squashfs-tools/action.c:476: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
#  474|   	 */
#  475|   	if(test->args != -2 && args != test->args) {
#  476|-> 		SYNTAX_ERROR("Unexpected number of arguments, expected %d, "
#  477|   			"got %d\n", test->args, args);
#  478|   		goto failed;

Error: CPPCHECK_WARNING (CWE-476): [#def7]
squashfs-tools-4.6.1/squashfs-tools/action.c:513: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
#  511|   		return parse_test(string);
#  512|   	default:
#  513|-> 		SYNTAX_ERROR("Unexpected token \"%s\", expected test "
#  514|   					"operation, \"!\", or \"(\"\n",
#  515|   					TOK_TO_STR(token, string));

Error: CPPCHECK_WARNING (CWE-476): [#def8]
squashfs-tools-4.6.1/squashfs-tools/action.c:532: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
#  530|   			if (subexp) {
#  531|   				free_parse_tree(expr);
#  532|-> 				SYNTAX_ERROR("Expected \"&&\", \"||\" or "
#  533|   						"\")\", got EOF\n");
#  534|   				return NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def9]
squashfs-tools-4.6.1/squashfs-tools/action.c:542: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
#  540|   			if (!subexp) {
#  541|   				free_parse_tree(expr);
#  542|-> 				SYNTAX_ERROR("Unexpected \")\", expected "
#  543|   						"\"&&\", \"!!\" or EOF\n");
#  544|   				return NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def10]
squashfs-tools-4.6.1/squashfs-tools/action.c:551: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
#  549|   		if (op != TOK_AND && op != TOK_OR) {
#  550|   			free_parse_tree(expr);
#  551|-> 			SYNTAX_ERROR("Unexpected token \"%s\", expected "
#  552|   				"\"&&\" or \"||\"\n", TOK_TO_STR(op, string));
#  553|   			return NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def11]
squashfs-tools-4.6.1/squashfs-tools/action.c:580: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
#  578|   
#  579|   	if (token != TOK_STRING) {
#  580|-> 		SYNTAX_ERROR("Unexpected token \"%s\", expected name\n",
#  581|   						TOK_TO_STR(token, string));
#  582|   		return 0;

Error: CPPCHECK_WARNING (CWE-476): [#def12]
squashfs-tools-4.6.1/squashfs-tools/action.c:590: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
#  588|   
#  589|   	if (action_table[i].args == -1) {
#  590|-> 		SYNTAX_ERROR("Non-existent action \"%s\"\n", string);
#  591|   		return 0;
#  592|   	}

Error: CPPCHECK_WARNING (CWE-476): [#def13]
squashfs-tools-4.6.1/squashfs-tools/action.c:602: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
#  600|   
#  601|   	if (token != TOK_OPEN_BRACKET) {
#  602|-> 		SYNTAX_ERROR("Unexpected token \"%s\", expected \"(\"\n",
#  603|   						TOK_TO_STR(token, string));
#  604|   		goto failed;

Error: CPPCHECK_WARNING (CWE-476): [#def14]
squashfs-tools-4.6.1/squashfs-tools/action.c:618: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
#  616|   	while (1) {
#  617|   		if (token != TOK_STRING) {
#  618|-> 			SYNTAX_ERROR("Unexpected token \"%s\", expected "
#  619|   				"argument\n", TOK_TO_STR(token, string));
#  620|   			goto failed;

Error: CPPCHECK_WARNING (CWE-401): [#def15]
squashfs-tools-4.6.1/squashfs-tools/action.c:623: error[memleakOnRealloc]: Common realloc mistake: 'argv' nulled but not freed upon failure
#  621|   		}
#  622|   
#  623|-> 		argv = realloc(argv, (args + 1) * sizeof(char *));
#  624|   		if (argv == NULL)
#  625|   			MEM_ERROR();

Error: CPPCHECK_WARNING (CWE-476): [#def16]
squashfs-tools-4.6.1/squashfs-tools/action.c:635: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
#  633|   
#  634|   		if (token != TOK_COMMA) {
#  635|-> 			SYNTAX_ERROR("Unexpected token \"%s\", expected "
#  636|   				"\",\" or \")\"\n", TOK_TO_STR(token, string));
#  637|   			goto failed;

Error: CPPCHECK_WARNING (CWE-476): [#def17]
squashfs-tools-4.6.1/squashfs-tools/action.c:647: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
#  645|   	 */
#  646|   	if(action->args != -2 && args != action->args) {
#  647|-> 		SYNTAX_ERROR("Unexpected number of arguments, expected %d, "
#  648|   			"got %d\n", action->args, args);
#  649|   		goto failed;

Error: CPPCHECK_WARNING (CWE-476): [#def18]
squashfs-tools-4.6.1/squashfs-tools/action.c:663: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
#  661|   
#  662|   	if (token != TOK_AT) {
#  663|-> 		SYNTAX_ERROR("Unexpected token \"%s\", expected \"@\"\n",
#  664|   						TOK_TO_STR(token, string));
#  665|   		goto failed;

Error: CPPCHECK_WARNING (CWE-401): [#def19]
squashfs-tools-4.6.1/squashfs-tools/action.c:715: error[memleakOnRealloc]: Common realloc mistake: 'spec_list' nulled but not freed upon failure
#  713|   	}
#  714|   	
#  715|-> 	*spec_list = realloc(*spec_list, (spec_count + 1) *
#  716|   					sizeof(struct action));
#  717|   	if (*spec_list == NULL)

Error: CPPCHECK_WARNING (CWE-401): [#def20]
squashfs-tools-4.6.1/squashfs-tools/action.c:778: error[memleakOnRealloc]: Common realloc mistake: 'expr_msg' nulled but not freed upon failure
#  776|   		alloc_size = (cur_size + size + ALLOC_SZ - 1) & ~(ALLOC_SZ - 1);
#  777|   
#  778|-> 		expr_msg = realloc(expr_msg, alloc_size);
#  779|   		if(expr_msg == NULL)
#  780|   			MEM_ERROR();

Error: GCC_ANALYZER_WARNING (CWE-401): [#def21]
squashfs-tools-4.6.1/squashfs-tools/action.c:778:17: warning[-Wanalyzer-malloc-leak]: leak of ‘expr_msg’
squashfs-tools-4.6.1/squashfs-tools/action.c:887:12: enter_function: entry to ‘eval_expr_top’
squashfs-tools-4.6.1/squashfs-tools/action.c:892:17: call_function: inlined call to ‘expr_log_cmnd’ from ‘eval_expr_top’
squashfs-tools-4.6.1/squashfs-tools/action.c:892:17: call_function: inlined call to ‘expr_log_cmnd’ from ‘eval_expr_top’
squashfs-tools-4.6.1/squashfs-tools/action.c:894:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/action.c:895:25: call_function: inlined call to ‘expr_log’ from ‘eval_expr_top’
#  776|   		alloc_size = (cur_size + size + ALLOC_SZ - 1) & ~(ALLOC_SZ - 1);
#  777|   
#  778|-> 		expr_msg = realloc(expr_msg, alloc_size);
#  779|   		if(expr_msg == NULL)
#  780|   			MEM_ERROR();

Error: CPPCHECK_WARNING (CWE-476): [#def22]
squashfs-tools-4.6.1/squashfs-tools/action.c:1200: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 1198|   	if (*b == '\0') {
# 1199|   		if (uid < 0 || uid >= (1LL << 32)) {
# 1200|-> 			SYNTAX_ERROR("Uid out of range\n");
# 1201|   			return -1;
# 1202|   		}

Error: CPPCHECK_WARNING (CWE-476): [#def23]
squashfs-tools-4.6.1/squashfs-tools/action.c:1209: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 1207|   			uid = passwd->pw_uid;
# 1208|   		else {
# 1209|-> 			SYNTAX_ERROR("Invalid uid or unknown user\n");
# 1210|   			return -1;
# 1211|   		}

Error: CPPCHECK_WARNING (CWE-476): [#def24]
squashfs-tools-4.6.1/squashfs-tools/action.c:1224: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 1222|   	if (*b == '\0') {
# 1223|   		if (gid < 0 || gid >= (1LL << 32)) {
# 1224|-> 			SYNTAX_ERROR("Gid out of range\n");
# 1225|   			return -1;
# 1226|   		}

Error: CPPCHECK_WARNING (CWE-476): [#def25]
squashfs-tools-4.6.1/squashfs-tools/action.c:1233: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 1231|   			gid = group->gr_gid;
# 1232|   		else {
# 1233|-> 			SYNTAX_ERROR("Invalid gid or unknown group\n");
# 1234|   			return -1;
# 1235|   		}

Error: CPPCHECK_WARNING (CWE-476): [#def26]
squashfs-tools-4.6.1/squashfs-tools/action.c:1355: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 1353|   	/* check there's no trailing junk */
# 1354|   	if (argv[0][bytes] != '\0') {
# 1355|-> 		SYNTAX_ERROR("Unexpected trailing bytes after octal "
# 1356|   			"mode number\n");
# 1357|   		return 0; /* bad octal number arg */

Error: CPPCHECK_WARNING (CWE-476): [#def27]
squashfs-tools-4.6.1/squashfs-tools/action.c:1362: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 1360|   	/* check there's only one argument */
# 1361|   	if (args > 1) {
# 1362|-> 		SYNTAX_ERROR("Octal mode number is first argument, "
# 1363|   			"expected one argument, got %d\n", args);
# 1364|   		return 0; /* bad octal number arg */

Error: CPPCHECK_WARNING (CWE-476): [#def28]
squashfs-tools-4.6.1/squashfs-tools/action.c:1369: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 1367|   	/*  check mode is within range */
# 1368|   	if (mode > 07777) {
# 1369|-> 		SYNTAX_ERROR("Octal mode %o is out of range\n", mode);
# 1370|   		return 0; /* bad octal number arg */
# 1371|   	}

Error: CPPCHECK_WARNING (CWE-476): [#def29]
squashfs-tools-4.6.1/squashfs-tools/action.c:1429: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 1427|   	/* trap a symbolic mode with just an ownership specification */
# 1428|   	if(*arg == '\0') {
# 1429|-> 		SYNTAX_ERROR("Expected one of '+', '-' or '=', got EOF\n");
# 1430|   		goto failed;
# 1431|   	}

Error: CPPCHECK_WARNING (CWE-476): [#def30]
squashfs-tools-4.6.1/squashfs-tools/action.c:1448: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 1446|   			break;
# 1447|   		default:
# 1448|-> 			SYNTAX_ERROR("Expected one of '+', '-' or '=', got "
# 1449|   				"'%c'\n", *arg);
# 1450|   			goto failed;

Error: CPPCHECK_WARNING (CWE-476): [#def31]
squashfs-tools-4.6.1/squashfs-tools/action.c:1489: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 1487|   					goto perms_parsed;
# 1488|   				default:
# 1489|-> 					SYNTAX_ERROR("Unrecognised permission "
# 1490|   								"'%c'\n", *arg);
# 1491|   					goto failed;

Error: CPPCHECK_WARNING (CWE-476): [#def32]
squashfs-tools-4.6.1/squashfs-tools/action.c:1544: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 1542|   
# 1543|   	if (args == 0) {
# 1544|-> 		SYNTAX_ERROR("Mode action expects one or more arguments\n");
# 1545|   		return 0;
# 1546|   	}

Error: CPPCHECK_WARNING (CWE-476): [#def33]
squashfs-tools-4.6.1/squashfs-tools/action.c:1628: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 1626|   
# 1627|   	if (args >= 2) {
# 1628|-> 		SYNTAX_ERROR("Empty action expects zero or one argument\n");
# 1629|   		return 0;
# 1630|   	}

Error: CPPCHECK_WARNING (CWE-476): [#def34]
squashfs-tools-4.6.1/squashfs-tools/action.c:1639: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 1637|   		val = EMPTY_EXCLUDED;
# 1638|   	else {
# 1639|-> 		SYNTAX_ERROR("Empty action expects zero arguments, or one"
# 1640|   			"argument containing \"all\", \"source\", or \"excluded\""
# 1641|   			"\n");

Error: CPPCHECK_WARNING (CWE-476): [#def35]
squashfs-tools-4.6.1/squashfs-tools/action.c:2173: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 2171|   
# 2172|   		regerror(error, &xattr_data->preg, str, 1024);
# 2173|-> 		SYNTAX_ERROR("invalid regex %s because %s\n", argv[0], str);
# 2174|   		free(xattr_data);
# 2175|   		return 0;

Error: CPPCHECK_WARNING (CWE-476): [#def36]
squashfs-tools-4.6.1/squashfs-tools/action.c:2430: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 2428|   
# 2429|   	if (res == 0) {
# 2430|-> 		TEST_SYNTAX_ERROR(test, 0, "%s\n", error);
# 2431|   		return 0;
# 2432|   	}

Error: CPPCHECK_WARNING (CWE-476): [#def37]
squashfs-tools-4.6.1/squashfs-tools/action.c:2457: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 2455|   	res = parse_number(atom->argv[0], &start, &type, &error);
# 2456|   	if (res == 0) {
# 2457|-> 		TEST_SYNTAX_ERROR(test, 0, "%s\n", error);
# 2458|   		return 0;
# 2459|   	}

Error: CPPCHECK_WARNING (CWE-476): [#def38]
squashfs-tools-4.6.1/squashfs-tools/action.c:2462: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 2460|   
# 2461|   	if (type != NUM_EQ) {
# 2462|-> 		TEST_SYNTAX_ERROR(test, 0, "Range specifier (<, >, -, +) not "
# 2463|   			"expected\n");
# 2464|   		return 0;

Error: CPPCHECK_WARNING (CWE-476): [#def39]
squashfs-tools-4.6.1/squashfs-tools/action.c:2469: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 2467|   	res = parse_number(atom->argv[1], &end, &type, &error);
# 2468|   	if (res == 0) {
# 2469|-> 		TEST_SYNTAX_ERROR(test, 1, "%s\n", error);
# 2470|   		return 0;
# 2471|   	}

Error: CPPCHECK_WARNING (CWE-476): [#def40]
squashfs-tools-4.6.1/squashfs-tools/action.c:2474: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 2472|   
# 2473|   	if (type != NUM_EQ) {
# 2474|-> 		TEST_SYNTAX_ERROR(test, 1, "Range specifier (<, >, -, +) not "
# 2475|   			"expected\n");
# 2476|   		return 0;

Error: CPPCHECK_WARNING (CWE-476): [#def41]
squashfs-tools-4.6.1/squashfs-tools/action.c:2596: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: path
# 2594|   	char *path = s;
# 2595|   
# 2596|-> 	for (count = 0; *path != '\0' && count < n; count ++) {
# 2597|   		while (*path == '/')
# 2598|   			path ++;

Error: CPPCHECK_WARNING (CWE-476): [#def42]
squashfs-tools-4.6.1/squashfs-tools/action.c:2597: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: path
# 2595|   
# 2596|   	for (count = 0; *path != '\0' && count < n; count ++) {
# 2597|-> 		while (*path == '/')
# 2598|   			path ++;
# 2599|   

Error: CPPCHECK_WARNING (CWE-476): [#def43]
squashfs-tools-4.6.1/squashfs-tools/action.c:2689: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 2687|   		size = uid->pw_uid;
# 2688|   	else {
# 2689|-> 		TEST_SYNTAX_ERROR(test, 1, "Unknown user\n");
# 2690|   		return 0;
# 2691|   	}

Error: CPPCHECK_WARNING (CWE-476): [#def44]
squashfs-tools-4.6.1/squashfs-tools/action.c:2720: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 2718|   		size = gid->gr_gid;
# 2719|   	else {
# 2720|-> 		TEST_SYNTAX_ERROR(test, 1, "Unknown group\n");
# 2721|   		return 0;
# 2722|   	}

Error: CPPCHECK_WARNING (CWE-476): [#def45]
squashfs-tools-4.6.1/squashfs-tools/action.c:2769: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 2767|   
# 2768|   failed:
# 2769|-> 	TEST_SYNTAX_ERROR(test, 0, "Unexpected file type, expected 'f', 'd', "
# 2770|   		"'c', 'b', 'l', 's' or 'p'\n");
# 2771|   	return 0;

Error: CPPCHECK_WARNING (CWE-476): [#def46]
squashfs-tools-4.6.1/squashfs-tools/action.c:2818: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 2816|   		regerror(res, preg, str, 1024);
# 2817|   		free(preg);
# 2818|-> 		TEST_SYNTAX_ERROR(test, 0, "invalid regex \"%s\" because "
# 2819|   			"\"%s\"\n", atom->argv[0], str);
# 2820|   		return 0;

Error: CPPCHECK_WARNING (CWE-401): [#def47]
squashfs-tools-4.6.1/squashfs-tools/action.c:2865: error[memleakOnRealloc]: Common realloc mistake: 'buffer' nulled but not freed upon failure
# 2863|   
# 2864|   	do {
# 2865|-> 		buffer = realloc(buffer, size + 512);
# 2866|   		if (buffer == NULL)
# 2867|   			MEM_ERROR();

Error: CPPCHECK_WARNING (CWE-476): [#def48]
squashfs-tools-4.6.1/squashfs-tools/action.c:3122: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 3120|   		 * test().  So here additionally report our failure to parse
# 3121|   		 * the expression in the stat() test to give context */
# 3122|-> 		TEST_SYNTAX_ERROR(test, 0, "Failed to parse expression\n");
# 3123|   		return 0;
# 3124|   	}

Error: CPPCHECK_WARNING (CWE-476): [#def49]
squashfs-tools-4.6.1/squashfs-tools/action.c:3359: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: src
# 3357|   
# 3358|   	if(atom->args == 0) {
# 3359|-> 		TEST_SYNTAX_ERROR(test, 0, "One or more arguments expected\n");
# 3360|   		return 0;
# 3361|   	}

Error: CPPCHECK_WARNING (CWE-401): [#def50]
squashfs-tools-4.6.1/squashfs-tools/mksquashfs.c:870: error[memleakOnRealloc]: Common realloc mistake: 'pathname' nulled but not freed upon failure
#  868|   			 */
#  869|   			size = (res + ALLOC_SIZE) & ~(ALLOC_SIZE - 1);
#  870|-> 			pathname = realloc(pathname, size);
#  871|   			if(pathname == NULL)
#  872|   				MEM_ERROR();

Error: CPPCHECK_WARNING (CWE-401): [#def51]
squashfs-tools-4.6.1/squashfs-tools/mksquashfs.c:909: error[memleakOnRealloc]: Common realloc mistake: 'subpath' nulled but not freed upon failure
#  907|   			 */
#  908|   			size = (res + ALLOC_SIZE) & ~(ALLOC_SIZE - 1);
#  909|-> 			subpath = realloc(subpath, size);
#  910|   			if(subpath == NULL)
#  911|   				MEM_ERROR();

Error: CPPCHECK_WARNING (CWE-401): [#def52]
squashfs-tools-4.6.1/squashfs-tools/mksquashfs.c:2797: error[memleakOnRealloc]: Common realloc mistake: 'block_list' nulled but not freed upon failure
# 2795|   				start=0;
# 2796|   		} else {
# 2797|-> 			block_list = realloc(block_list, (block + 1) *
# 2798|   				sizeof(unsigned int));
# 2799|   			if(block_list == NULL)

Error: CPPCHECK_WARNING (CWE-401): [#def53]
squashfs-tools-4.6.1/squashfs-tools/mksquashfs.c:3198: error[memleakOnRealloc]: Common realloc mistake: 'b_buffer' nulled but not freed upon failure
# 3196|   
# 3197|   		/* Buffer not large enough, realloc and try again */
# 3198|-> 		b_buffer = realloc(b_buffer, b_size += BUFF_SIZE);
# 3199|   		if(b_buffer == NULL)
# 3200|   			MEM_ERROR();

Error: CPPCHECK_WARNING (CWE-401): [#def54]
squashfs-tools-4.6.1/squashfs-tools/mksquashfs.c:5133: error[memleakOnRealloc]: Common realloc mistake: 'exclude_paths' nulled but not freed upon failure
# 5131|   			return TRUE;
# 5132|   		}
# 5133|-> 		ADD_ENTRY(buf);
# 5134|   		return TRUE;
# 5135|   	}

Error: CPPCHECK_WARNING (CWE-401): [#def55]
squashfs-tools-4.6.1/squashfs-tools/mksquashfs.c:5151: error[memleakOnRealloc]: Common realloc mistake: 'exclude_paths' nulled but not freed upon failure
# 5149|   		}
# 5150|   		free(filename);
# 5151|-> 		ADD_ENTRY(buf);
# 5152|   	}
# 5153|   	return TRUE;

Error: CPPCHECK_WARNING (CWE-401): [#def56]
squashfs-tools-4.6.1/squashfs-tools/mksquashfs.c:5160: error[memleakOnRealloc]: Common realloc mistake: 'old_root_entry' nulled but not freed upon failure
# 5158|   	unsigned int inode_number, int type)
# 5159|   {
# 5160|-> 	old_root_entry = realloc(old_root_entry,
# 5161|   		sizeof(struct old_root_entry_info) * (old_root_entries + 1));
# 5162|   	if(old_root_entry == NULL)

Error: CPPCHECK_WARNING (CWE-401): [#def57]
squashfs-tools-4.6.1/squashfs-tools/mksquashfs.c:7459: error[memleakOnRealloc]: Common realloc mistake: 'exclude_paths' nulled but not freed upon failure
# 7457|   				exit(1);
# 7458|   			}
# 7459|-> 			ADD_ENTRY(buf);
# 7460|   		} else {
# 7461|   			perror("Could not stat destination file");

Error: CPPCHECK_WARNING (CWE-401): [#def58]
squashfs-tools-4.6.1/squashfs-tools/mksquashfs.c:7497: error[memleakOnRealloc]: Common realloc mistake: 'exclude_paths' nulled but not freed upon failure
# 7495|   			 * the destination file as input, which
# 7496|   			 * will result in an I/O loop */
# 7497|-> 			ADD_ENTRY(buf);
# 7498|   		}
# 7499|   	}

Error: CPPCHECK_WARNING (CWE-401): [#def59]
squashfs-tools-4.6.1/squashfs-tools/mksquashfs.c:8538: error[memleakOnRealloc]: Common realloc mistake: 'exclude_paths' nulled but not freed upon failure
# 8536|   				exit(1);
# 8537|   			}
# 8538|-> 			ADD_ENTRY(buf);
# 8539|   		} else {
# 8540|   			perror("Could not stat destination file");

Error: CPPCHECK_WARNING (CWE-401): [#def60]
squashfs-tools-4.6.1/squashfs-tools/mksquashfs.c:8577: error[memleakOnRealloc]: Common realloc mistake: 'exclude_paths' nulled but not freed upon failure
# 8575|   			 * the destination file as input, which
# 8576|   			 * will result in an I/O loop */
# 8577|-> 			ADD_ENTRY(buf);
# 8578|   		}
# 8579|   	}

Error: CPPCHECK_WARNING (CWE-401): [#def61]
squashfs-tools-4.6.1/squashfs-tools/mksquashfs.c:8725: error[memleakOnRealloc]: Common realloc mistake: 'fragment_table' nulled but not freed upon failure
# 8723|   		}
# 8724|   		if((fragments = sBlk.fragments)) {
# 8725|-> 			fragment_table = realloc((char *) fragment_table,
# 8726|   				((fragments + FRAG_SIZE - 1) & ~(FRAG_SIZE - 1))
# 8727|   				 * sizeof(struct squashfs_fragment_entry)); 

Error: GCC_ANALYZER_WARNING (CWE-775): [#def62]
squashfs-tools-4.6.1/squashfs-tools/process_fragments.c:270:11: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(destination_file, 0)’
squashfs-tools-4.6.1/squashfs-tools/process_fragments.c:265:14: acquire_resource: opened here
squashfs-tools-4.6.1/squashfs-tools/process_fragments.c:266:11: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/process_fragments.c:269:23: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/process_fragments.c:270:11: danger: ‘open(destination_file, 0)’ leaks here; was opened at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  268|   
#  269|   	data_buffer = malloc(SQUASHFS_FILE_MAX_SIZE);
#  270|-> 	if(data_buffer == NULL)
#  271|   		MEM_ERROR();
#  272|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def63]
squashfs-tools-4.6.1/squashfs-tools/process_fragments.c:276:51: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(destination_file, 0)’
squashfs-tools-4.6.1/squashfs-tools/process_fragments.c:265:14: acquire_resource: opened here
squashfs-tools-4.6.1/squashfs-tools/process_fragments.c:266:11: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/process_fragments.c:269:23: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/process_fragments.c:270:11: branch_false: following ‘false’ branch (when ‘data_buffer’ is non-NULL)...
squashfs-tools-4.6.1/squashfs-tools/process_fragments.c:270:11: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/process_fragments.c:320:23: branch_true: following ‘true’ branch (when ‘dupl_ptr’ is non-NULL)...
squashfs-tools-4.6.1/squashfs-tools/process_fragments.c:321:41: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/process_fragments.c:338:27: branch_true: following ‘true’ branch (when ‘flag == 0’)...
squashfs-tools-4.6.1/squashfs-tools/process_fragments.c:339:42: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/process_fragments.c:341:35: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/process_fragments.c:351:57: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/process_fragments.c:354:27: branch_true: following ‘true’ branch (when ‘res == 0’)...
squashfs-tools-4.6.1/squashfs-tools/process_fragments.c:355:59: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/process_fragments.c:276:51: danger: ‘open(destination_file, 0)’ leaks here; was opened at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  274|   
#  275|   	while(1) {
#  276|-> 		struct file_buffer *file_buffer = queue_get(to_process_frag);
#  277|   		struct file_buffer *buffer;
#  278|   		int sparse = checksum_sparse(file_buffer);

Error: CPPCHECK_WARNING (CWE-401): [#def64]
squashfs-tools-4.6.1/squashfs-tools/pseudo.c:1222: error[memleakOnRealloc]: Common realloc mistake: 'line' nulled but not freed upon failure
# 1220|   
# 1221|   			if(total + (MAX_LINE + 1) > size) {
# 1222|-> 				line = realloc(line, size += (MAX_LINE + 1));
# 1223|   				if(line == NULL)
# 1224|   					MEM_ERROR();

Error: CPPCHECK_WARNING (CWE-401): [#def65]
squashfs-tools-4.6.1/squashfs-tools/read_fs.c:153: error[memleakOnRealloc]: Common realloc mistake: 'inode_table' nulled but not freed upon failure
#  151|   		}
#  152|   		if(size - bytes < SQUASHFS_METADATA_SIZE) {
#  153|-> 			inode_table = realloc(inode_table, size += alloc_size);
#  154|   			if(inode_table == NULL)
#  155|   				MEM_ERROR();

Error: GCC_ANALYZER_WARNING (CWE-401): [#def66]
squashfs-tools-4.6.1/squashfs-tools/read_xattrs.c:104:16: warning[-Wanalyzer-malloc-leak]: leak of ‘xattr_list’
squashfs-tools-4.6.1/squashfs-tools/read_xattrs.c:359:20: enter_function: entry to ‘get_xattr’
squashfs-tools-4.6.1/squashfs-tools/read_xattrs.c:369:11: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/read_xattrs.c:375:17: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/read_xattrs.c:381:11: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/read_xattrs.c:388:16: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/read_xattrs.c:393:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/read_xattrs.c:397:19: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/read_xattrs.c:397:19: branch_true: following ‘true’ branch (when ‘res != 0’)...
squashfs-tools-4.6.1/squashfs-tools/read_xattrs.c:398:58: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/read_xattrs.c:400:27: branch_false: following ‘false’ branch (when ‘xattr_list’ is non-NULL)...
squashfs-tools-4.6.1/squashfs-tools/read_xattrs.c:407:17: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/read_xattrs.c:410:23: call_function: calling ‘read_xattr_entry’ from ‘get_xattr’
squashfs-tools-4.6.1/squashfs-tools/read_xattrs.c:410:23: return_function: returning to ‘get_xattr’ from ‘read_xattr_entry’
squashfs-tools-4.6.1/squashfs-tools/read_xattrs.c:411:19: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/read_xattrs.c:418:26: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/read_xattrs.c:418:26: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/read_xattrs.c:419:25: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/read_xattrs.c:104:16: danger: ‘xattr_list’ leaks here; was allocated at [(10)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/9)
#  102|   		hash_entry ? hash_entry->offset : -1);
#  103|   
#  104|-> 	return hash_entry ? hash_entry->offset : -1;
#  105|   }
#  106|   

Error: CPPCHECK_WARNING (CWE-401): [#def67]
squashfs-tools-4.6.1/squashfs-tools/read_xattrs.c:270: error[memleakOnRealloc]: Common realloc mistake: 'xattrs' nulled but not freed upon failure
#  268|   	for(i = 0; start < end; i++) {
#  269|   		int length, res;
#  270|-> 		xattrs = realloc(xattrs, (i + 1) * SQUASHFS_METADATA_SIZE);
#  271|   		if(xattrs == NULL) {
#  272|   			ERROR("FATAL ERROR: Out of memory (%s)\n", __func__);

Error: CPPCHECK_WARNING (CWE-401): [#def68]
squashfs-tools-4.6.1/squashfs-tools/read_xattrs.c:398: error[memleakOnRealloc]: Common realloc mistake: 'xattr_list' nulled but not freed upon failure
#  396|   
#  397|   		if(res != 0) {
#  398|-> 			xattr_list = realloc(xattr_list, (j + 1) *
#  399|   						sizeof(struct xattr_list));
#  400|   			if(xattr_list == NULL) {

Error: CPPCHECK_WARNING (CWE-401): [#def69]
squashfs-tools-4.6.1/squashfs-tools/reader.c:94: error[memleakOnRealloc]: Common realloc mistake: 'pathname' nulled but not freed upon failure
#   92|   			 */
#   93|   			size = (res + ALLOC_SIZE) & ~(ALLOC_SIZE - 1);
#   94|-> 			pathname = realloc(pathname, size);
#   95|   			if(pathname == NULL)
#   96|   				MEM_ERROR();

Error: GCC_ANALYZER_WARNING (CWE-688): [#def70]
squashfs-tools-4.6.1/squashfs-tools/tar.c:364:13: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘name’ where non-null expected
squashfs-tools-4.6.1/squashfs-tools/tar.c:1564:16: enter_function: entry to ‘process_tar_file’
squashfs-tools-4.6.1/squashfs-tools/tar.c:1579:19: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/tar.c:1584:20: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/tar.c:1611:23: call_function: calling ‘add_tarfile’ from ‘process_tar_file’
#  362|   	source = get_component(source, &name);
#  363|   
#  364|-> 	if((strcmp(name, ".") == 0) || strcmp(name, "..") == 0)
#  365|   		BAD_ERROR("Error: Tar pathname can't have '.' or '..' in it\n");
#  366|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def71]
squashfs-tools-4.6.1/squashfs-tools/tar.c:483:13: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘name’ where non-null expected
squashfs-tools-4.6.1/squashfs-tools/tar.c:1564:16: enter_function: entry to ‘process_tar_file’
squashfs-tools-4.6.1/squashfs-tools/tar.c:1579:19: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/tar.c:1584:20: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/tar.c:1584:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/tar.c:1587:49: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/tar.c:1587:49: call_function: calling ‘lookup_pathname’ from ‘process_tar_file’
#  481|   	pathname = get_component(pathname, &name);
#  482|   
#  483|-> 	if((strcmp(name, ".") == 0) || strcmp(name, "..") == 0) {
#  484|   		ERROR("Error: Tar hardlink pathname can't have '.' or '..' in it\n");
#  485|   		return NULL;

Error: CPPCHECK_WARNING (CWE-401): [#def72]
squashfs-tools-4.6.1/squashfs-tools/tar.c:1003: error[memleakOnRealloc]: Common realloc mistake: 'map' nulled but not freed upon failure
# 1001|   		}
# 1002|   
# 1003|-> 		map = realloc(map, (map_entries + 21) * sizeof(struct file_map));
# 1004|   		if(map == NULL)
# 1005|   			MEM_ERROR();

Error: CPPCHECK_WARNING (CWE-401): [#def73]
squashfs-tools-4.6.1/squashfs-tools/tar.c:1118: error[memleakOnRealloc]: Common realloc mistake: 'map' nulled but not freed upon failure
# 1116|   
# 1117|   			if(i % 50 == 0) {
# 1118|-> 				map = realloc(map, (i + 50) * sizeof(struct file_map));
# 1119|   				if(map == NULL)
# 1120|   					MEM_ERROR();

Error: GCC_ANALYZER_WARNING (CWE-688): [#def74]
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:1484:20: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘targname’ where non-null expected
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:1576:6: enter_function: entry to ‘add_exclude’
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:1579:30: call_function: calling ‘add_path’ from ‘add_exclude’
# 1482|   
# 1483|   	for(i = 0; i < paths->names; i++)
# 1484|-> 		if(strcmp(paths->name[i].name, targname) == 0)
# 1485|   			break;
# 1486|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def75]
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:1566:16: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:4488:5: enter_function: entry to ‘main’
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:4497:11: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:4501:23: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:4508:11: branch_false: following ‘false’ branch (when the strings are non-equal)...
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:4511:21: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:4511:21: call_function: calling ‘parse_options’ from ‘main’
# 1564|   	}
# 1565|   
# 1566|-> 	return paths;
# 1567|   }
# 1568|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def76]
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:1566:16: warning[-Wanalyzer-malloc-leak]: leak of ‘paths’
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:4488:5: enter_function: entry to ‘main’
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:4497:11: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:4501:23: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:4508:11: branch_false: following ‘false’ branch (when the strings are non-equal)...
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:4511:21: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:4511:21: call_function: calling ‘parse_options’ from ‘main’
# 1564|   	}
# 1565|   
# 1566|-> 	return paths;
# 1567|   }
# 1568|   

Error: GCC_ANALYZER_WARNING (CWE-465): [#def77]
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:1602:19: warning[-Wanalyzer-deref-before-check]: check of ‘paths’ for NULL after already dereferencing it
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:1617:5: enter_function: entry to ‘extract_matches’
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:1629:20: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:1630:34: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:1634:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:1635:48: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:1644:27: branch_true: following ‘true’ branch (when ‘match != 0’)...
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:1644:37: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:1644:28: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:1658:40: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/unsquashfs.c:1658:40: call_function: calling ‘add_subdir’ from ‘extract_matches’
# 1600|   			(paths->count + PATHS_ALLOC_SIZE) *
# 1601|   			sizeof(struct pathname *));
# 1602|-> 		if(paths == NULL)
# 1603|   			MEM_ERROR();
# 1604|   	}

Error: GCC_ANALYZER_WARNING (CWE-688): [#def78]
squashfs-tools-4.6.1/squashfs-tools/xattr.c:119:20: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘name’ where non-null expected
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1153:19: enter_function: entry to ‘xattr_parse’
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1163:11: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1169:11: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1169:11: branch_false: following ‘false’ branch (when ‘value != str’)...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1175:12: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1175:11: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1181:17: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1182:11: branch_false: following ‘false’ branch (when ‘entry’ is non-NULL)...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1185:36: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1185:23: acquire_memory: this call could return NULL
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1186:23: call_function: calling ‘xattr_get_type’ from ‘xattr_parse’
#  117|   	for(i = 0; prefix_table[i].type != -1; i++) {
#  118|   		struct prefix *p = &prefix_table[i];
#  119|-> 		if(strncmp(name, p->prefix, strlen(p->prefix)) == 0)
#  120|   			break;
#  121|   	}

Error: CPPCHECK_WARNING (CWE-682): [#def79]
squashfs-tools-4.6.1/squashfs-tools/xattr.c:130: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
#  128|   {
#  129|   	xattr->full_name = strdup(name);
#  130|-> 	xattr->name = xattr->full_name + strlen(prefix_table[t].prefix);
#  131|   	xattr->size = strlen(xattr->name);
#  132|   }

Error: CPPCHECK_WARNING (CWE-401): [#def80]
squashfs-tools-4.6.1/squashfs-tools/xattr.c:328: error[memleakOnRealloc]: Common realloc mistake: 'xattr_table' nulled but not freed upon failure
#  326|   		if((xattr_size - xattr_bytes) <
#  327|   				((SQUASHFS_METADATA_SIZE << 1)) + 2) {
#  328|-> 			xattr_table = realloc(xattr_table, xattr_size +
#  329|   				(SQUASHFS_METADATA_SIZE << 1) + 2);
#  330|   			if(xattr_table == NULL)

Error: CPPCHECK_WARNING (CWE-401): [#def81]
squashfs-tools-4.6.1/squashfs-tools/xattr.c:352: error[memleakOnRealloc]: Common realloc mistake: 'data_cache' nulled but not freed upon failure
#  350|   	if(data_space < req_size) {
#  351|   			int realloc_size = req_size - data_space;
#  352|-> 			data_cache = realloc(data_cache, cache_size +
#  353|   				realloc_size);
#  354|   			if(data_cache == NULL)

Error: CPPCHECK_WARNING (CWE-401): [#def82]
squashfs-tools-4.6.1/squashfs-tools/xattr.c:468: error[memleakOnRealloc]: Common realloc mistake: 'xattr_id_table' nulled but not freed upon failure
#  466|   	struct squashfs_xattr_id *xattr_id;
#  467|   
#  468|-> 	xattr_id_table = realloc(xattr_id_table, (xattr_ids + 1) *
#  469|   		sizeof(struct squashfs_xattr_id));
#  470|   	if(xattr_id_table == NULL)

Error: CPPCHECK_WARNING (CWE-401): [#def83]
squashfs-tools-4.6.1/squashfs-tools/xattr.c:511: error[memleakOnRealloc]: Common realloc mistake: 'xattr_table' nulled but not freed upon failure
#  509|   		if((xattr_size - xattr_bytes) <
#  510|   				((SQUASHFS_METADATA_SIZE << 1)) + 2) {
#  511|-> 			xattr_table = realloc(xattr_table, xattr_size +
#  512|   				(SQUASHFS_METADATA_SIZE << 1) + 2);
#  513|   			if(xattr_table == NULL)

Error: GCC_ANALYZER_WARNING (CWE-476): [#def84]
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1019:25: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘dest_ptr’
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1000:16: acquire_memory: this call could return NULL
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1002:48: branch_true: following ‘true’ branch (when ‘size != 0’)...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1003:29: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1018:19: branch_false: following ‘false’ branch (when ‘bit_pos != 24’)...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1027:26: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1002:48: branch_true: following ‘true’ branch (when ‘size != 0’)...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1003:29: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1019:25: danger: ‘dest_ptr’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0)
# 1017|   
# 1018|   		if(bit_pos == 24) {
# 1019|-> 			dest_ptr[0] = output >> 16;
# 1020|   			dest_ptr[1] = (output >> 8) & 0xff;
# 1021|   			dest_ptr[2] = output & 0xff;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def85]
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1037:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘dest_ptr’
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1153:19: enter_function: entry to ‘xattr_parse’
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1163:11: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1169:11: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1169:11: branch_false: following ‘false’ branch (when ‘value != str’)...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1175:12: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1175:11: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1181:17: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1182:11: branch_false: following ‘false’ branch (when ‘entry’ is non-NULL)...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1185:36: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1186:23: call_function: calling ‘xattr_get_type’ from ‘xattr_parse’
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1186:23: return_function: returning to ‘xattr_parse’ from ‘xattr_get_type’
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1188:11: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1197:12: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1197:11: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1204:27: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1210:19: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1217:53: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1217:32: call_function: calling ‘base64_decode’ from ‘xattr_parse’
# 1035|   
# 1036|   	if(bit_pos >= 12)
# 1037|-> 		dest_ptr[0] = output >> 16;
# 1038|   
# 1039|   	if(bit_pos >= 18)

Error: GCC_ANALYZER_WARNING (CWE-457): [#def86]
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1218:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘size’
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1153:19: enter_function: entry to ‘xattr_parse’
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1163:11: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1169:11: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1169:11: branch_false: following ‘false’ branch (when ‘value != str’)...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1175:12: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1175:11: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1181:17: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1182:11: branch_false: following ‘false’ branch (when ‘entry’ is non-NULL)...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1185:36: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1186:23: call_function: calling ‘xattr_get_type’ from ‘xattr_parse’
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1186:23: return_function: returning to ‘xattr_parse’ from ‘xattr_get_type’
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1188:11: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1197:12: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1197:11: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1204:27: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1210:19: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1217:53: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1217:32: call_function: calling ‘base64_decode’ from ‘xattr_parse’
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1217:32: return_function: returning to ‘xattr_parse’ from ‘base64_decode’
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1218:17: danger: use of uninitialized value ‘size’ here
# 1216|   
# 1217|   		entry->value = base64_decode(value, strlen(value), &size);
# 1218|-> 		entry->vsize = size;
# 1219|   
# 1220|   		if(entry->value == NULL) {

Error: GCC_ANALYZER_WARNING (CWE-457): [#def87]
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1238:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘size’
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1153:19: enter_function: entry to ‘xattr_parse’
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1163:11: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1169:11: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1169:11: branch_false: following ‘false’ branch (when ‘value != str’)...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1175:12: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1175:11: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1181:17: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1182:11: branch_false: following ‘false’ branch (when ‘entry’ is non-NULL)...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1185:36: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1186:23: call_function: calling ‘xattr_get_type’ from ‘xattr_parse’
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1186:23: return_function: returning to ‘xattr_parse’ from ‘xattr_get_type’
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1188:11: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1197:12: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1197:11: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1204:27: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1230:19: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1237:50: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xattr.c:1238:17: danger: use of uninitialized value ‘size’ here
# 1236|   
# 1237|   		entry->value = hex_decode(value, strlen(value), &size);
# 1238|-> 		entry->vsize = size;
# 1239|   
# 1240|   		if(entry->value == NULL) {

Error: GCC_ANALYZER_WARNING (CWE-126): [#def88]
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:40: warning[-Wanalyzer-out-of-bounds]: buffer over-read
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:389:11: branch_false: following ‘false’ branch (when ‘filter’ is non-NULL)...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:392:26: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:393:11: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:396:9: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:411:27: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:411:27: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:411:27: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:411:27: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:411:27: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:411:27: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:411:27: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch (when ‘datablock != 0’)...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:40: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:40: danger: out-of-bounds read from byte 168 till byte 175 but ‘bcj’ ends at byte 168
#  406|   	filter[0].filter[1].id = LZMA_VLI_UNKNOWN;
#  407|   
#  408|-> 	for(i = 0, j = 1; datablock && bcj[i].name; i++) {
#  409|   		if(bcj[i].selected) {
#  410|   			filter[j].buffer = malloc(block_size);

Error: GCC_ANALYZER_WARNING (CWE-126): [#def89]
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:20: warning[-Wanalyzer-out-of-bounds]: buffer over-read
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:389:11: branch_false: following ‘false’ branch (when ‘filter’ is non-NULL)...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:392:26: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:393:11: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:396:9: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:411:27: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:411:27: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:411:27: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:411:27: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:411:27: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:411:27: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:411:27: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:20: danger: out-of-bounds read from byte 184 till byte 187 but ‘bcj’ ends at byte 168
#  407|   
#  408|   	for(i = 0, j = 1; datablock && bcj[i].name; i++) {
#  409|-> 		if(bcj[i].selected) {
#  410|   			filter[j].buffer = malloc(block_size);
#  411|   			if(filter[j].buffer == NULL)

Error: GCC_ANALYZER_WARNING (CWE-126): [#def90]
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: warning[-Wanalyzer-out-of-bounds]: buffer over-read
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:389:11: branch_false: following ‘false’ branch (when ‘filter’ is non-NULL)...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:392:26: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:393:11: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:396:9: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:411:27: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:411:27: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:411:27: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:411:27: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:411:27: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:411:27: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:411:27: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:411:27: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: danger: out-of-bounds read from byte 176 till byte 183 but ‘bcj’ ends at byte 168
#  411|   			if(filter[j].buffer == NULL)
#  412|   				goto failed3;
#  413|-> 			filter[j].filter[0].id = bcj[i].id;
#  414|   			filter[j].filter[1].id = LZMA_FILTER_LZMA2;
#  415|   			filter[j].filter[1].options = &stream->opt;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def91]
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:429:9: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:389:11: branch_false: following ‘false’ branch (when ‘filter’ is non-NULL)...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:392:26: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:393:11: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:396:9: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: acquire_memory: allocated here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:411:27: branch_false: following ‘false’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:413:50: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:408:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:409:19: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:410:44: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:411:27: branch_true: following ‘true’ branch...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:412:33: branch_true: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:424:20: branch_false: following ‘false’ branch (when ‘i >= filters’)...
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:426:9: branch_false: ...to here
squashfs-tools-4.6.1/squashfs-tools/xz_wrapper.c:429:9: danger: ‘<unknown>’ leaks here; was allocated at [(9)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/8)
#  427|   
#  428|   failed2:
#  429|-> 	free(filter);
#  430|   
#  431|   failed:

Scan Properties

analyzer-version-clippy1.95.0
analyzer-version-cppcheck2.20.0
analyzer-version-gcc16.1.1
analyzer-version-gcc-analyzer16.1.1
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.95.0
diffbase-analyzer-version-cppcheck2.20.0
diffbase-analyzer-version-gcc16.1.1
diffbase-analyzer-version-gcc-analyzer16.1.1
diffbase-analyzer-version-shellcheck0.11.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-24.us-west-2.compute.internal
diffbase-known-false-positives/usr/share/csmock/known-false-positives.js
diffbase-known-false-positives-rpmknown-false-positives-0.0.0.20260524.213755.g3c6d0be.main-1.el9.noarch
diffbase-mock-configfedora-rawhide-x86_64
diffbase-project-namesquashfs-tools-4.7.4-1.fc45
diffbase-store-results-to/tmp/tmpy4021jpw/squashfs-tools-4.7.4-1.fc45.tar.xz
diffbase-time-created2026-06-01 16:54:25
diffbase-time-finished2026-06-01 16:56:02
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'shellcheck,cppcheck,clippy,unicontrol,gcc' '-o' '/tmp/tmpy4021jpw/squashfs-tools-4.7.4-1.fc45.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpy4021jpw/squashfs-tools-4.7.4-1.fc45.src.rpm'
diffbase-tool-versioncsmock-3.8.5.20260529.133039.g6f3b5c6-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-24.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-namesquashfs-tools-4.6.1-8.fc44
store-results-to/tmp/tmpo5udnl8w/squashfs-tools-4.6.1-8.fc44.tar.xz
time-created2026-06-01 16:52:01
time-finished2026-06-01 16:54:03
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'shellcheck,cppcheck,clippy,unicontrol,gcc' '-o' '/tmp/tmpo5udnl8w/squashfs-tools-4.6.1-8.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpo5udnl8w/squashfs-tools-4.6.1-8.fc44.src.rpm'
tool-versioncsmock-3.8.5.20260529.133039.g6f3b5c6-1.el9