Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ __pycache__
*.rej
/fuzz/corpus/json/*
!/fuzz/corpus/json/*.json
*.code-workspace
5 changes: 3 additions & 2 deletions VM/src/ares.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1780,6 +1780,9 @@ u_proto(Info *info) { /* ... proto */
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.

eris_error(info, "malformed data: invalid yield point");
}
}

// Assign bytecodeid at the end after all dangerous unpersist calls
Expand Down Expand Up @@ -2268,8 +2271,6 @@ p_thread(Info *info) { /* ... thread */

// PC relative to the start of the code
int64_t pc_offset = ci->savedpc - lcl->l.p->code;
// the PC had better be in bounds.
eris_assert(pc_offset >= 0 && pc_offset < lcl->l.p->sizecode);

int yield_point = -1;
for (int j = 0; j< lcl->l.p->sizeyieldpoints; ++j) {
Expand Down
13 changes: 13 additions & 0 deletions VM/src/lvmload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,19 @@ static int loadsafe(
for (int j = 0; j < num_yields; ++j)
{
p->yieldpoints[j] = readVarInt(data, size, offset);
if (p->yieldpoints[j] < 0 || p->yieldpoints[j] >= p->sizecode)
{
char chunkbuf[LUA_IDSIZE];
const char* chunkid = luaO_chunkid(chunkbuf, sizeof(chunkbuf), chunkname, strlen(chunkname));
lua_pushfstring(
L,
"%s: malformed bytecode: invalid yield point %d in proto %d",
chunkid,
p->yieldpoints[j],
i
);
return 1;
}
}

protos[i] = p;
Expand Down
Empty file modified build-cmd.sh
100644 → 100755
Empty file.
Empty file modified init_debian_buster.sh
100644 → 100755
Empty file.