Merge pull request #14052 from s-hadinger/berry_latest_fix

Latest Berry fixes
This commit is contained in:
s-hadinger 2021-12-14 22:10:46 +01:00 committed by GitHub
commit 00a02cca41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;