markusfisch / BinaryEye

Yet another barcode scanner for Android
https://play.google.com/store/apps/details?id=de.markusfisch.android.binaryeye
MIT License
1.26k stars 108 forks source link

Null character is not handled correctly from escaped string input at Compose barcode #455

Closed raron closed 2 months ago

raron commented 2 months ago

Hello,

BinaryEye can decode barcodes containing raw / binary data (even null / zero bytes), and it can re-encode it when Compose barcode is chosen (the Content field is readonly and shows "(binary data)" in that case).

But if Compose barcode is started from the main menu (and not from the results page of an already decoded barcode), the Expand escape sequences is checked and the Conents field contains an escape sequence for null byte (eg. \x00 or \0), that and the rest of the input is stripped from the generated barcode.

(From a quick check I suspect this could be fixed easily by handling the results of String.unescape() as ByteArray, too, in EncodeFragment, but I could not try it.)

Tested version: 1.63.7 (versionCode 135) from F-Droid.

Here is a QR code I used for testing, it is created by qrencode and contains _\0_ (0x5f, 0x00, 0x5f):

a

P.S. thanks for one of the best barcode reader

markusfisch commented 2 months ago

Hi, and thanks for filing an issue about this! And, of course, for using Binary Eye!

You are right! The text needs to be a ByteArray in this case. Fixed in https://github.com/markusfisch/BinaryEye/commit/91336fe15ce71d8b4f71350cb46f1a240ac62d56

A new version is coming soon!