mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-03 07:32:00 +00:00
Userland: Add missing checks for MappedFile.is_valid()
This commit is contained in:
parent
17248ab6fe
commit
538a3a2579
Notes:
sideshowbarker
2024-07-19 04:26:54 +09:00
Author: https://github.com/BenWiederhake
Commit: 538a3a2579
Pull-request: https://github.com/SerenityOS/serenity/pull/2931
2 changed files with 6 additions and 0 deletions
|
@ -37,6 +37,10 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
MappedFile file(argv[1]);
|
MappedFile file(argv[1]);
|
||||||
|
if (!file.is_valid()) {
|
||||||
|
// Already printed some error message.
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
X86::SimpleInstructionStream stream((const u8*)file.data(), file.size());
|
X86::SimpleInstructionStream stream((const u8*)file.data(), file.size());
|
||||||
X86::Disassembler disassembler(stream);
|
X86::Disassembler disassembler(stream);
|
||||||
|
|
|
@ -183,6 +183,8 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
MappedFile mapped_file { zip_file_path };
|
MappedFile mapped_file { zip_file_path };
|
||||||
|
if (!mapped_file.is_valid())
|
||||||
|
return 1;
|
||||||
|
|
||||||
printf("Archive: %s\n", zip_file_path.characters());
|
printf("Archive: %s\n", zip_file_path.characters());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue