8000 [BUG] Few bugs in v2.0 pocketpy.c that cause crashes (using uninitialized variables) · Issue #315 · pocketpy/pocketpy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
[BUG] Few bugs in v2.0 pocketpy.c that cause crashes (using uninitialized variables) #315
Closed
nesbox/TIC-80
#2730
@sasag0

Description

@sasag0

I have been testing v2.0 using pocketpy.c and pocketpy.h method. Mostly it works as expected, but I have found a few nasty oversight errors.

Bug description

Calling py_initialize() may fail because the very first thing it does it checks pk_current_vm pointer that is not initialized.
Function py_switchvm() has similar problem. It causes crash because VM__ctor() that should initialize new VM is somewhere calling function that uses pk_current_vm (still not changed to new VM)

Steps to reproduce

-Use py_initialize() in Debug build mode of MSVC so that it does not initialize variables automatically,
-try to use py_switchvm() in any form

Environment information

  • pocketpy v2.0 using pocketpy.c and pocketpy.h method and C bindings
  • windows 11, 64-bit
  • MSVC project

Additional context

As I have glanced through the code, I can see that many functions are using global pointer pk_current_vm (and more). Unless I am missing something, this is big limitation because multithreading (running multiple virtual machines at the same time) is not possible?
It would be much better if all functions would get VM context as a parameter?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0