File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -711,17 +711,17 @@ void QRCodeEncoderImpl::padBitStream()
711711 else if (pad_num <= 4 )
712712 {
713713 int payload_size = (int )payload.size ();
714- writeDecNumber ( 0 , payload_size, payload );
714+ payload. insert (payload. end () , payload_size, 0 );
715715 }
716716 else
717717 {
718- writeDecNumber ( 0 , 4 , payload );
718+ payload. insert (payload. end () , 4 , 0 );
719719
720720 int i = payload.size () % bits;
721721
722722 if (i != 0 )
723723 {
724- writeDecNumber ( 0 , bits - i, payload );
724+ payload. insert (payload. end () , bits - i, 0 );
725725 }
726726 pad_num = total_data - (int )payload.size ();
727727
@@ -1329,11 +1329,12 @@ class QRCodeDecoderImpl : public QRCodeDecoder {
13291329
13301330 int val = 0 ;
13311331 while (bits >= actualBits) {
1332+ CV_CheckLT (idx, data.size (), " Not enough bits in the bitstream" );
13321333 val |= data[idx++] << (bits - actualBits);
13331334 bits -= actualBits;
13341335 actualBits = 8 ;
13351336 }
1336- if (bits) {
1337+ if (bits && idx < data. size () ) {
13371338 val |= data[idx] >> (actualBits - bits);
13381339 actualBits -= bits;
13391340 data[idx] &= 255 >> (8 - actualBits);
You can’t perform that action at this time.
0 commit comments