summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/cbfstool/cbfs-mkstage.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/util/cbfstool/cbfs-mkstage.c b/util/cbfstool/cbfs-mkstage.c
index 6e8daef508..2f81da07d5 100644
--- a/util/cbfstool/cbfs-mkstage.c
+++ b/util/cbfstool/cbfs-mkstage.c
@@ -126,6 +126,11 @@ int parse_elf_to_stage(unsigned char *input, unsigned char **output,
data_start = *location;
}
+ if (data_end <= data_start) {
+ fprintf(stderr, "E: data ends before it starts. Make sure the ELF file is correct and resides in ROM space.\n");
+ exit(1);
+ }
+
/* allocate an intermediate buffer for the data */
buffer = calloc(data_end - data_start, 1);