mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-io/io.c: raise error if seek position is too big
This commit is contained in:
@@ -987,15 +987,10 @@ mrb_io_sysseek(mrb_state *mrb, mrb_value io)
|
||||
if (pos == -1) {
|
||||
mrb_sys_fail(mrb, "sysseek");
|
||||
}
|
||||
if (pos > MRB_INT_MAX) {
|
||||
#ifndef MRB_NO_FLOAT
|
||||
return mrb_float_value(mrb, (mrb_float)pos);
|
||||
#else
|
||||
mrb_raise(mrb, E_IO_ERROR, "sysseek reached too far for MRB_NO_FLOAT");
|
||||
#endif
|
||||
} else {
|
||||
return mrb_int_value(mrb, pos);
|
||||
if (pos > (off_t)MRB_INT_MAX) {
|
||||
mrb_raise(mrb, E_IO_ERROR, "sysseek reached too far for mrb_int");
|
||||
}
|
||||
return mrb_int_value(mrb, (mrb_int)pos);
|
||||
}
|
||||
|
||||
static mrb_value
|
||||
|
||||
Reference in New Issue
Block a user