Latest Berry fixes

This commit is contained in:
Stephan Hadinger 2021-12-14 21:51:12 +01:00
parent 05e72f6b9f
commit 2b97a03d4c
2 changed files with 4 additions and 1 deletions

View File

@ -650,6 +650,9 @@ buf_impl bytes_check_data(bvm *vm, size_t add_size) {
buf_impl attr = m_read_attributes(vm, 1);
/* check if the `size` is big enough */
if (attr.len + (int32_t)add_size > attr.size) {
if (attr.fixed) {
be_raise(vm, BYTES_RESIZE_ERROR, BYTES_RESIZE_MESSAGE);
}
/* it does not fit so we need to realocate the buffer */
bytes_resize(vm, &attr, attr.len + add_size);
}

View File

@ -174,7 +174,7 @@ void end_varinfo(bparser *parser, int beginpc)
if (beginpc == -1) /* use block->beginpc by default */
beginpc = binfo->beginpc;
/* skip the variable of the previous blocks */
for (; it->beginpc < beginpc; ++it);
for (; (it <= end) && (it->beginpc < beginpc); ++it);
for (; it <= end; ++it) {
if (!it->endpc) /* write to endpc only once */
it->endpc = finfo->pc;