Fixed out-of-bounds array read in fast Java implementation.

master
Project Nayuki 1 month ago
parent 2c9044de6b
commit 4127249bb9

@ -69,7 +69,7 @@ for (int y = 0; y < qr1.size; y++) {
License License
------- -------
Copyright © 2025 Project Nayuki. (MIT License) Copyright © 2026 Project Nayuki. (MIT License)
[https://www.nayuki.io/page/qr-code-generator-library](https://www.nayuki.io/page/qr-code-generator-library) [https://www.nayuki.io/page/qr-code-generator-library](https://www.nayuki.io/page/qr-code-generator-library)
Permission is hereby granted, free of charge, to any person obtaining a copy of Permission is hereby granted, free of charge, to any person obtaining a copy of

@ -130,7 +130,7 @@ public final class QrSegmentAdvanced {
charModes[i][0] = modeTypes[0]; charModes[i][0] = modeTypes[0];
} }
// Extend a segment if possible // Extend a segment if possible
if (QrSegment.ALPHANUMERIC_MAP[c] != -1) { // Is alphanumeric if (c < QrSegment.ALPHANUMERIC_MAP.length && QrSegment.ALPHANUMERIC_MAP[c] != -1) { // Is alphanumeric
curCosts[1] = prevCosts[1] + 33; // 5.5 bits per alphanumeric char curCosts[1] = prevCosts[1] + 33; // 5.5 bits per alphanumeric char
charModes[i][1] = modeTypes[1]; charModes[i][1] = modeTypes[1];
} }

Loading…
Cancel
Save