зеркало из https://github.com/github/ruby.git
compile.c: resize to align offsets
* compile.c (ibf_dump_align): resize the dump buffer. rb_str_modify_expand expands the buffer but not set the length. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
aa3b5b14e9
Коммит
2948dc26bd
12
compile.c
12
compile.c
|
@ -8204,7 +8204,13 @@ ibf_dump_align(struct ibf_dump *dump, size_t align)
|
|||
{
|
||||
ibf_offset_t pos = ibf_dump_pos(dump);
|
||||
if (pos % align) {
|
||||
rb_str_modify_expand(dump->str, align - (pos % align));
|
||||
long size = (long)pos - (pos % align) + align;
|
||||
#if SIZEOF_LONG > SIZEOF_INT
|
||||
if (pos >= UINT_MAX) {
|
||||
rb_raise(rb_eRuntimeError, "dump size exceeds");
|
||||
}
|
||||
#endif
|
||||
rb_str_resize(dump->str, size);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9553,6 +9559,10 @@ iseq_ibf_dump(const rb_iseq_t *iseq, VALUE opt)
|
|||
static const ibf_offset_t *
|
||||
ibf_iseq_list(const struct ibf_load *load)
|
||||
{
|
||||
if (load->header->iseq_list_offset % sizeof(ibf_offset_t)) {
|
||||
rb_raise(rb_eArgError, "unaligned iseq list offset: %u",
|
||||
load->header->iseq_list_offset);
|
||||
}
|
||||
return (ibf_offset_t *)(load->buff + load->header->iseq_list_offset);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче