mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Overflow bug fix
This commit is contained in:
parent
944a754fee
commit
0400d9d280
@ -985,8 +985,8 @@ int aztec(struct zint_symbol *symbol, unsigned char source[])
|
|||||||
|
|
||||||
/* Plot all of the data into the symbol in pre-defined spiral pattern */
|
/* Plot all of the data into the symbol in pre-defined spiral pattern */
|
||||||
if(compact) {
|
if(compact) {
|
||||||
for(y = AztecCompactOffset[layers - 1]; y < (28 - AztecCompactOffset[layers - 1]); y++) {
|
for(y = AztecCompactOffset[layers - 1]; y < (27 - AztecCompactOffset[layers - 1]); y++) {
|
||||||
for(x = AztecCompactOffset[layers - 1]; x < (28 - AztecCompactOffset[layers - 1]); x++) {
|
for(x = AztecCompactOffset[layers - 1]; x < (27 - AztecCompactOffset[layers - 1]); x++) {
|
||||||
if(CompactAztecMap[(y * 27) + x] == 1) {
|
if(CompactAztecMap[(y * 27) + x] == 1) {
|
||||||
symbol->encoded_data[y - AztecCompactOffset[layers - 1]][x - AztecCompactOffset[layers - 1]] = '1';
|
symbol->encoded_data[y - AztecCompactOffset[layers - 1]][x - AztecCompactOffset[layers - 1]] = '1';
|
||||||
}
|
}
|
||||||
@ -1001,8 +1001,8 @@ int aztec(struct zint_symbol *symbol, unsigned char source[])
|
|||||||
symbol->rows = 27 - (2 * AztecCompactOffset[layers - 1]);
|
symbol->rows = 27 - (2 * AztecCompactOffset[layers - 1]);
|
||||||
symbol->width = 27 - (2 * AztecCompactOffset[layers - 1]);
|
symbol->width = 27 - (2 * AztecCompactOffset[layers - 1]);
|
||||||
} else {
|
} else {
|
||||||
for(y = AztecOffset[layers - 1]; y < (152 - AztecOffset[layers - 1]); y++) {
|
for(y = AztecOffset[layers - 1]; y < (151 - AztecOffset[layers - 1]); y++) {
|
||||||
for(x = AztecOffset[layers - 1]; x < (152 - AztecOffset[layers - 1]); x++) {
|
for(x = AztecOffset[layers - 1]; x < (151 - AztecOffset[layers - 1]); x++) {
|
||||||
if(AztecMap[(y * 151) + x] == 1) {
|
if(AztecMap[(y * 151) + x] == 1) {
|
||||||
symbol->encoded_data[y - AztecOffset[layers - 1]][x - AztecOffset[layers - 1]] = '1';
|
symbol->encoded_data[y - AztecOffset[layers - 1]][x - AztecOffset[layers - 1]] = '1';
|
||||||
}
|
}
|
||||||
|
@ -189,17 +189,17 @@ static int CompactAztecMap[] = { /* 27 x 27 data grid */
|
|||||||
599,598,403,402,239,238,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,286,287,466,467,
|
599,598,403,402,239,238,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,286,287,466,467,
|
||||||
597,596,401,400,237,236,105,104,3,5,7,9,11,13,15,17,19,21,23,25,27,140,141,288,289,468,469,
|
597,596,401,400,237,236,105,104,3,5,7,9,11,13,15,17,19,21,23,25,27,140,141,288,289,468,469,
|
||||||
595,594,399,398,235,234,103,102,2,4,6,8,10,12,14,16,18,20,22,24,26,142,143,290,291,470,471,
|
595,594,399,398,235,234,103,102,2,4,6,8,10,12,14,16,18,20,22,24,26,142,143,290,291,470,471,
|
||||||
593,592,397,396,233,232,101,100,1,1,2004,2005,2006,2007,2008,2009,2010,0,1,28,29,144,145,292,293,472,473,
|
593,592,397,396,233,232,101,100,1,1,2000,2001,2002,2003,2004,2005,2006,0,1,28,29,144,145,292,293,472,473,
|
||||||
591,590,395,394,231,230,99,98,1,1,1,1,1,1,1,1,1,1,1,30,31,146,147,294,295,474,475,
|
591,590,395,394,231,230,99,98,1,1,1,1,1,1,1,1,1,1,1,30,31,146,147,294,295,474,475,
|
||||||
589,588,393,392,229,228,97,96,2031,1,0,0,0,0,0,0,0,1,2011,32,33,148,149,296,297,476,477,
|
589,588,393,392,229,228,97,96,2027,1,0,0,0,0,0,0,0,1,2007,32,33,148,149,296,297,476,477,
|
||||||
587,586,391,390,227,226,95,94,2030,1,0,1,1,1,1,1,0,1,2012,34,35,150,151,298,299,478,479,
|
587,586,391,390,227,226,95,94,2026,1,0,1,1,1,1,1,0,1,2008,34,35,150,151,298,299,478,479,
|
||||||
585,584,389,388,225,224,93,92,2029,1,0,1,0,0,0,1,0,1,2013,36,37,152,153,300,301,480,481,
|
585,584,389,388,225,224,93,92,2025,1,0,1,0,0,0,1,0,1,2009,36,37,152,153,300,301,480,481,
|
||||||
583,582,387,386,223,222,91,90,2028,1,0,1,0,1,0,1,0,1,2014,38,39,154,155,302,303,482,483,
|
583,582,387,386,223,222,91,90,2024,1,0,1,0,1,0,1,0,1,2010,38,39,154,155,302,303,482,483,
|
||||||
581,580,385,384,221,220,89,88,2027,1,0,1,0,0,0,1,0,1,2015,40,41,156,157,304,305,484,485,
|
581,580,385,384,221,220,89,88,2023,1,0,1,0,0,0,1,0,1,2011,40,41,156,157,304,305,484,485,
|
||||||
579,578,383,382,219,218,87,86,2026,1,0,1,1,1,1,1,0,1,2016,42,43,158,159,306,307,486,487,
|
579,578,383,382,219,218,87,86,2022,1,0,1,1,1,1,1,0,1,2012,42,43,158,159,306,307,486,487,
|
||||||
577,576,381,380,217,216,85,84,2025,1,0,0,0,0,0,0,0,1,2017,44,45,160,161,308,309,488,489,
|
577,576,381,380,217,216,85,84,2021,1,0,0,0,0,0,0,0,1,2013,44,45,160,161,308,309,488,489,
|
||||||
575,574,379,378,215,214,83,82,0,1,1,1,1,1,1,1,1,1,1,46,47,162,163,310,311,490,491,
|
575,574,379,378,215,214,83,82,0,1,1,1,1,1,1,1,1,1,1,46,47,162,163,310,311,490,491,
|
||||||
573,572,377,376,213,212,81,80,0,0,2024,2023,2022,2021,2020,2019,2018,0,0,48,49,164,165,312,313,492,493,
|
573,572,377,376,213,212,81,80,0,0,2020,2019,2018,2017,2016,2015,2014,0,0,48,49,164,165,312,313,492,493,
|
||||||
571,570,375,374,211,210,78,76,74,72,70,68,66,64,62,60,58,56,54,50,51,166,167,314,315,494,495,
|
571,570,375,374,211,210,78,76,74,72,70,68,66,64,62,60,58,56,54,50,51,166,167,314,315,494,495,
|
||||||
569,568,373,372,209,208,79,77,75,73,71,69,67,65,63,61,59,57,55,52,53,168,169,316,317,496,497,
|
569,568,373,372,209,208,79,77,75,73,71,69,67,65,63,61,59,57,55,52,53,168,169,316,317,496,497,
|
||||||
567,566,371,370,206,204,202,200,198,196,194,192,190,188,186,184,182,180,178,176,174,170,171,318,319,498,499,
|
567,566,371,370,206,204,202,200,198,196,194,192,190,188,186,184,182,180,178,176,174,170,171,318,319,498,499,
|
||||||
|
@ -71,6 +71,11 @@ int qr_code(struct zint_symbol *symbol, unsigned char source[])
|
|||||||
int errno = 0;
|
int errno = 0;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
|
if(ustrlen(source) > 5254) {
|
||||||
|
strcpy(symbol->errtxt, "input data too long [580]");
|
||||||
|
return ERROR_TOO_LONG;
|
||||||
|
}
|
||||||
|
|
||||||
code = encode(symbol->option_1, symbol->option_2, source);
|
code = encode(symbol->option_1, symbol->option_2, source);
|
||||||
if(code == NULL) {
|
if(code == NULL) {
|
||||||
strcpy(symbol->errtxt, "libqrencode failed to encode the input data [581]");
|
strcpy(symbol->errtxt, "libqrencode failed to encode the input data [581]");
|
||||||
|
Loading…
Reference in New Issue
Block a user