Skip to content

Conversation

@dilyanpalauzov
Copy link

CommPortIdentifier.java:getPortIdentifiers() calls (new RXTXCommDriver()).initialize() → RXTXCommDriver.java:initialize() → registerKnownPorts(CommPortIdentifier.PORT_SERIAL) → SerialImp.c:RXTXCommDriver(registerKnownPorts) → getRegistryString() → and it returns its value in a static allocated string (static char resultStr[256]).

If two threads call at the same time CommPortIdentifier.java:getPortIdentifiers(), both threads will write at the same time in that static char resultStr[256].

Likewise, when two threads at the same time call RXTXCommDriver.isPortPrefixValid(), there will also be multithreading problem, the only fact which saves the situation is that this is not called from anywhere.

  • This affects only Apple.

CommPortIdentifier.java:getPortIdentifiers() calls `(new RXTXCommDriver()).initialize()` → RXTXCommDriver.java:initialize() → registerKnownPorts(CommPortIdentifier.PORT_SERIAL) → SerialImp.c:RXTXCommDriver(registerKnownPorts) → getRegistryString() → and it returns its value in a static allocated string (`static char resultStr[256]`).

If two threads call at the same time CommPortIdentifier.java:getPortIdentifiers(), both threads will write at the same time in that `static char resultStr[256]`.

Likewise, when two threads at the same time call RXTXCommDriver.isPortPrefixValid(), there will also be multithreading problem, the only fact which saves the situation is that this is not called from anywhere.
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.

1 participant