openbsd-ports/graphics/zint/patches/patch-backend_common_c
jasper fe8b4a58f7 import zint 2.4.3
Zint is a C library for encoding data in several barcode variants. The
bundled command-line utility provides a simple interface to the library.
Features of the library:
- Over 50 symbologies including all ISO/IEC standards, like QR codes.
- Unicode translation for symbologies which support Latin-1 and
  Kanji character sets.
[...]

from Kirill Bychkov (MAINTAINER)
with tweaks by me and sthen@
ok sthen@
2011-12-23 15:08:07 +00:00

18 lines
749 B
Plaintext

$OpenBSD: patch-backend_common_c,v 1.1.1.1 2011/12/23 15:08:07 jasper Exp $
--- backend/common.c.orig Mon May 16 21:12:46 2011
+++ backend/common.c Mon Nov 14 20:01:43 2011
@@ -127,6 +127,13 @@ void lookup(char set_string[], char *table[], char dat
int module_is_set(struct zint_symbol *symbol, int y_coord, int x_coord)
{
+ /* be sure you have y_coord <= ZINT_ROWS_MAX or (x_coord/7) <= ZINT_COLS_MAX
+ without this you will have coredump, be sure module_is_set(symbol, this_row, i + block_width) != module_is_set(symbol, this_row, i) */
+ if(y_coord > ZINT_ROWS_MAX)
+ return y_coord;
+ if((x_coord/7) > ZINT_COLS_MAX)
+ return x_coord;
+
return (symbol->encoded_data[y_coord][x_coord / 7] >> (x_coord % 7)) & 1;
#if 0
switch(x_sub) {