File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,22 @@ def test_glog_zero_data_with_leading_zeros():
3636 qr .make ()
3737
3838
39+ def test_glog_zero_binary_data_at_capacity ():
40+ """Regression test for issue #423: glog(0) with binary null bytes at capacity limit."""
41+ from qrcode .util import QRData , MODE_8BIT_BYTE
42+
43+ # Version 5 + Q = 60 bytes capacity, data padded with trailing null bytes
44+ data = (
45+ b"\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x01 \x00 \x00 \x00 \x16 "
46+ b"Hello from kakaworld!!"
47+ + b"\x00 " * 26
48+ )
49+ assert len (data ) == 60
50+ qr = qrcode .QRCode (version = 5 , error_correction = qrcode .constants .ERROR_CORRECT_Q )
51+ qr .add_data (QRData (data , mode = MODE_8BIT_BYTE ))
52+ qr .make (fit = False )
53+
54+
3955def test_invalid_version ():
4056 with pytest .raises (ValueError ):
4157 qrcode .QRCode (version = 42 )
You can’t perform that action at this time.
0 commit comments