Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Fix buffer length for QR code gen. (#5447)
Browse files Browse the repository at this point in the history
  • Loading branch information
gavofyork authored Apr 12, 2017
1 parent a0d8353 commit 1b36a38
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion js/src/ui/QrCode/qrSize.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ const QR_SIZES = [
export function calculateType (lengthBytes, errorLevel = 'M') {
let type = 5;

while (type < 40 && lengthBytes > QR_SIZES[errorLevel][type - 1]) {
// subtract 3 from the capacities, since we need 2 bits for the mode and a
// bunch more for the length.
while (type < 40 && lengthBytes > QR_SIZES[errorLevel][type - 1] - 3) {
type++;
}

Expand Down

0 comments on commit 1b36a38

Please sign in to comment.