Skip to content
Snippets Groups Projects
Commit 971974f0 authored by Kevin Wolf's avatar Kevin Wolf Committed by Paolo Bonzini
Browse files

dmg: warn when opening dmg images containing blocks of unknown type


Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
Signed-off-by: default avatarClaudio Fontana <cfontana@suse.de>
Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
Message-Id: <20220929093035.4231-5-cfontana@suse.de>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent c551fb0b
No related branches found
No related tags found
No related merge requests found
......@@ -254,6 +254,25 @@ static int dmg_read_mish_block(BDRVDMGState *s, DmgHeaderState *ds,
for (i = s->n_chunks; i < s->n_chunks + chunk_count; i++) {
s->types[i] = buff_read_uint32(buffer, offset);
if (!dmg_is_known_block_type(s->types[i])) {
switch (s->types[i]) {
case UDBZ:
warn_report_once("dmg-bzip2 module is missing, accessing bzip2 "
"compressed blocks will result in I/O errors");
break;
case ULFO:
warn_report_once("dmg-lzfse module is missing, accessing lzfse "
"compressed blocks will result in I/O errors");
break;
case UDCM:
case UDLE:
/* Comments and last entry can be ignored without problems */
break;
default:
warn_report_once("Image contains chunks of unknown type %x, "
"accessing them will result in I/O errors",
s->types[i]);
break;
}
chunk_count--;
i--;
offset += 40;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment