Skip to content

Commit

Permalink
fix: invalid read of memory in Stack::top() fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
mrunix00 committed Mar 18, 2024
1 parent 587aae5 commit ccc3c91
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/bytecode/vm/Stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ namespace Bytecode {
}

StackObject top() {
uint8_t type = *(stackTop - 1);

if (!used)
return StackObject{};

uint8_t type = *(stackTop - 1);

StackObject object{};
size_t size;

Expand Down
3 changes: 1 addition & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ file(
./*.cpp
)

add_executable(all_tests ${SRCS}
variables_test.cpp)
add_executable(all_tests ${SRCS})

target_link_libraries(all_tests GTest::gtest_main GTest::gmock_main)

Expand Down

0 comments on commit ccc3c91

Please sign in to comment.