felHR85 / UsbSerial

Usb serial controller for Android
MIT License
1.81k stars 590 forks source link

InputStream integer return fixes. #184

Closed twsmith85 closed 5 years ago

twsmith85 commented 5 years ago

Fix one condition where read returns a large negative integer instead of the correct byte value. Fix a second condition where checkFromBuffer returns a negative number and triggers a serial read before the buffer is depleted.

For example, if 0xFE is read from the buffer, Setting an integer equal to the buffer value results in 0xFFFFFFFE, which is out of the byte range.