aboutsummaryrefslogtreecommitdiff
path: root/hw/core/loader.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/core/loader.c')
-rw-r--r--hw/core/loader.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/core/loader.c b/hw/core/loader.c
index e5e8cbb..ebe574c 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -146,7 +146,7 @@ int load_image_targphys_as(const char *filename,
int size;
size = get_image_size(filename);
- if (size > max_sz) {
+ if (size < 0 || size > max_sz) {
return -1;
}
if (size > 0) {
@@ -168,7 +168,7 @@ int load_image_mr(const char *filename, MemoryRegion *mr)
size = get_image_size(filename);
- if (size > memory_region_size(mr)) {
+ if (size < 0 || size > memory_region_size(mr)) {
return -1;
}
if (size > 0) {