Skip to content

Issue server/2342: change assert in serialization to not fire for pc …#54

Merged
HaroldCindy merged 2 commits intomainfrom
ghi-2342
Feb 27, 2026
Merged

Issue server/2342: change assert in serialization to not fire for pc …#54
HaroldCindy merged 2 commits intomainfrom
ghi-2342

Conversation

@Rider-Linden
Copy link
Contributor

fixes https://github.com/secondlife/server/issues/2342: Only assert on an out of range PC if the script is not in a crashed state.

…if script in crashed state. Set run bit on two buld scripts.
Copy link
Contributor

@HaroldCindy HaroldCindy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Just one note

VM/src/ares.cpp Outdated
// the PC had better be in bounds.
eris_assert(pc_offset >= 0 && pc_offset < lcl->l.p->sizecode);
// If we have a thread that hasn't been hard-killed, the PC had better be in bounds.
eris_assert(thread->status != LUA_ERRKILL && pc_offset >= 0 && pc_offset < lcl->l.p->sizecode);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be better keep the assert as-is, but push it into the

      if (yield_point == -1) {
          switch(thread->status) {
            case LUA_OK:
            case LUA_YIELD:
            case LUA_BREAK:
              // expected to be valid, but is not

case below. We expect that for any out-of-bounds pc_offset it would eventually end up in that branch anyways, and doing the yieldpoints check with an OOB value will just always result in -1

Copy link
Contributor Author

@Rider-Linden Rider-Linden Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That path ends up calling erris_error, which terminates and reports an error. The assert would be redundant in that situation and could just be removed in favor of the error report couldn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for (i=0; i<p->sizeyieldpoints; ++i)
{
p->yieldpoints[i] = READ_VALUE(int32_t);
if (p->yieldpoints[i] < 0 || p->yieldpoints[i] >= p->sizecode) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yield points being initialized from incoming (unknown) bytecode could be out of range. Raise the error here.

Copy link
Contributor

@HaroldCindy HaroldCindy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@HaroldCindy HaroldCindy merged commit ce25003 into main Feb 27, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants