mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
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:
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user