Package: release.debian.org
Severity: normal
User: release.debian....@packages.debian.org
Usertags: unblock

Please unblock package iec16022.

The package builds correctly on all release architectures:
https://buildd.debian.org/status/package.php?p=iec16022&suite=sid

This upload fixes 3 bugs for cases where iec16022 fails to correctly
encode data to a barcode. As these problems are not easily spotted by
the human eye this is a kind of data loss bug.

The patches have been cherry-picked from the new upstream and a user who
reported the bugs confirmed that iec16022 now creates correct barcodes.

Unblocking this will also fix datamatrix barcode generation in gLabels
as gLabels relies on iec16022 for this kind of barcode.

Debian bug numbers: #429210 #773819 #835296

Source debdiff:

diff -u iec16022-0.2.4/debian/changelog iec16022-0.2.4/debian/changelog
--- iec16022-0.2.4/debian/changelog
+++ iec16022-0.2.4/debian/changelog
@@ -1,3 +1,16 @@
+iec16022 (0.2.4-1.2) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Cherry-pick from upstream:
+    - Fix EDIFACT encoding (0f2adb)
+      (Closes: #773719)
+    - Fix encoding of _. (45813a)
+      (Closes: #429210)
+    - Fix cases where data might be lost. (ebbb6e2)
+      (Closes: #835296)
+
+ -- Jakob Haufe <su...@sur5r.net>  Sun, 19 Feb 2017 00:00:24 +0100
+
 iec16022 (0.2.4-1.1) unstable; urgency=low
 
   * Non-maintainer upload.
only in patch2:
unchanged:
--- iec16022-0.2.4.orig/iec16022ecc200.c
+++ iec16022-0.2.4/iec16022ecc200.c
@@ -255,7 +255,7 @@
                        {
                                char out[6], p = 0;
                                const char *e,
-                                   *s2 = "!\"#$%&'()*+,-./:;<=>?@[\\]_",
+                                   *s2 = "!\"#$%&'()*+,-./:;<=>?@[\\]^_",
                                    *s3 = 0;
                                if (newenc == 'c') {
                                        e = " 
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
@@ -321,11 +321,11 @@
                                                        }
                                                }
                                        }
-                                       if (p == 2 && tp + 2 == tl && sp == sl)
-                                               out[p++] = 0;   // shift 1 pad 
at end
-                                       while (p >= 3) {
-                                               int v =
-                                                   out[0] * 1600 +
+                                       while (p >= 3 || (p && sp == sl)) {
+                                               int v;
+                                               while (p < 3) out[p++] = 0; // 
pad at end
+                                               if (tp + 2 >= tl) return 0; // 
not enough space
+                                               v = out[0] * 1600 +
                                                    out[1] * 40 + out[2] + 1;
                                                if (enc != newenc) {
                                                        if (enc == 'c'
@@ -356,26 +356,36 @@
                case 'e':       // EDIFACT
                        {
                                unsigned char out[4], p = 0;
-                               if (enc != newenc) {    // can only be from 
C40/Text/X12
+                               if (enc != 'a' && enc != newenc) {      // can 
only be from C40/Text/X12
                                        t[tp++] = 254;
                                        enc = 'a';
                                }
+                               if (enc == 'a')
+                               {
+                                       t[tp++] = 240;
+                                       enc = 'e';
+                               }
                                while (sp < sl && tolower(encoding[sp]) == 'e'
-                                      && p < 4)
+                                      && p < 4) {
+                                       if (s[sp] < 32 || s[sp] > 94) {
+                                               fprintf(stderr, "Cannot encode 
0x%02X in EDIFACT\n", s[sp]);
+                                               return 0;
+                                       }
                                        out[p++] = s[sp++];
+                               }
                                if (p < 4) {
                                        out[p++] = 0x1F;
                                        enc = 'a';
                                }       // termination
-                               t[tp] = ((s[0] & 0x3F) << 2);
-                               t[tp++] |= ((s[1] & 0x30) >> 4);
-                               t[tp] = ((s[1] & 0x0F) << 4);
+                               t[tp] = ((out[0] & 0x3F) << 2);
+                               t[tp++] |= ((out[1] & 0x30) >> 4);
+                               t[tp] = ((out[1] & 0x0F) << 4);
                                if (p == 2)
                                        tp++;
                                else {
-                                       t[tp++] |= ((s[2] & 0x3C) >> 2);
-                                       t[tp] = ((s[2] & 0x03) << 6);
-                                       t[tp++] |= (s[3] & 0x3F);
+                                       t[tp++] |= ((out[2] & 0x3C) >> 2);
+                                       t[tp] = ((out[2] & 0x03) << 6);
+                                       t[tp++] |= (out[3] & 0x3F);
                                }
                        }
                        break;
@@ -420,6 +430,7 @@
                                        t[tp] = s[sp++] + (((tp + 1) * 149) % 
255) + 1; // see annex H
                                        tp++;
                                }
+                               if (l) return 0; // not enough space
                                enc = 'a';      // reverse to ASCII at end
                        }
                        break;



unblock iec16022/0.2.4-1.2

-- System Information:
Debian Release: 9.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Reply via email to