fix possible unsigned integer underflow

buf_size has to be greater than header_size, otherwise subtracting
header_size from buf_size will cause an integer underflow.

Being equal to header_size is fine, however useless, so quit early.
This commit is contained in:
cremno
2015-04-28 14:53:50 +02:00
parent 0518ab22c4
commit 091ce867c1
+1 -1
View File
@@ -673,7 +673,7 @@ mrb_read_irep_file(mrb_state *mrb, FILE* fp)
goto irep_exit;
}
result = read_binary_header(buf, &buf_size, NULL, &flags);
if (result != MRB_DUMP_OK) {
if (result != MRB_DUMP_OK || buf_size <= header_size) {
goto irep_exit;
}