Skip to content

Fix chd_read_header_core_file_callbacks #160

Merged
rtissera merged 1 commit into
rtissera:masterfrom
xakep666:fix-read-header
May 8, 2026
Merged

Fix chd_read_header_core_file_callbacks #160
rtissera merged 1 commit into
rtissera:masterfrom
xakep666:fix-read-header

Conversation

@xakep666
Copy link
Copy Markdown
Contributor

@xakep666 xakep666 commented May 4, 2026

Populate file size before calling header_read because now it performs check

	/* totalhunks is used to size the map allocation; a malformed header
	 * can otherwise request multi-GB allocations for map[] even when the
	 * file itself is tiny. Every hunk map entry consumes at least one bit
	 * in the compressed on-disk map, so totalhunks cannot legitimately
	 * exceed file_size * 8. */
	if ((uint64_t)header->totalhunks > chd->file_size * 8)
		return CHDERR_INVALID_DATA;

@xakep666 xakep666 force-pushed the fix-read-header branch from a3d33f4 to 798a4f7 Compare May 4, 2026 09:45
@rtissera rtissera merged commit a369a70 into rtissera:master May 8, 2026
26 checks passed
@xakep666 xakep666 deleted the fix-read-header branch May 8, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants