Commit 091ce867 authored by cremno's avatar cremno

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.
parent 0518ab22
...@@ -673,7 +673,7 @@ mrb_read_irep_file(mrb_state *mrb, FILE* fp) ...@@ -673,7 +673,7 @@ mrb_read_irep_file(mrb_state *mrb, FILE* fp)
goto irep_exit; goto irep_exit;
} }
result = read_binary_header(buf, &buf_size, NULL, &flags); 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; goto irep_exit;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment