mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
iseq.h: check range
* iseq.h (iseq_catch_table_bytes): check range and suppress a warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
083c5896ca
commit
ca2d6be10f
1 changed files with 6 additions and 2 deletions
8
iseq.h
8
iseq.h
|
@ -76,8 +76,12 @@ PACKED_STRUCT_UNALIGNED(struct iseq_catch_table {
|
|||
static inline int
|
||||
iseq_catch_table_bytes(int n)
|
||||
{
|
||||
return sizeof(struct iseq_catch_table) +
|
||||
(n - 1) * sizeof(struct iseq_catch_table_entry);
|
||||
enum {
|
||||
catch_table_entries_max = (INT_MAX - sizeof(struct iseq_catch_table)) / sizeof(struct iseq_catch_table_entry)
|
||||
};
|
||||
if (n > catch_table_entries_max) rb_fatal("too large iseq_catch_table - %d", n);
|
||||
return (int)(sizeof(struct iseq_catch_table) +
|
||||
(n - 1) * sizeof(struct iseq_catch_table_entry));
|
||||
}
|
||||
|
||||
#define INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE (512)
|
||||
|
|
Loading…
Reference in a new issue