code:
diff -up unzip60/match.c.recmatch unzip60/match.c
--- unzip60/match.c.recmatch	2005-08-14 13:00:36.000000000 -0400
+++ unzip60/match.c	2013-05-28 10:29:57.949077543 -0400
@@ -27,16 +27,14 @@

   ---------------------------------------------------------------------------

-  Copyright on recmatch() from Zip's util.c (although recmatch() was almost
-  certainly written by Mark Adler...ask me how I can tell :-) ):
+  Copyright on recmatch() from Zip's util.c
+	 Copyright (c) 1990-2005 Info-ZIP.  All rights reserved.

-     Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
-     Kai Uwe Rommel and Igor Mandrichenko.
+	 See the accompanying file LICENSE, version 2004-May-22 or later
+	 for terms of use.
+	 If, for some reason, both of these files are missing, the Info-ZIP license
+	 also may be found at:  ftp://ftp.info-zip.org/pub/infozip/license.html

-     Permission is granted to any individual or institution to use, copy,
-     or redistribute this software so long as all of the original files are
-     included unmodified, that it is not sold for profit, and that this copy-
-     right notice is retained.

   ---------------------------------------------------------------------------

@@ -53,7 +51,7 @@

   A set is composed of characters or ranges; a range looks like ``character
   hyphen character'' (as in 0-9 or A-Z).  [0-9a-zA-Z_] is the minimal set of
-  characters allowed in the [..] pattern construct.  Other characters are
+  characters ALlowed in the [..] pattern construct.  Other characters are
   allowed (i.e., 8-bit characters) if your system will support them.

   To suppress the special syntactic significance of any of ``[]*?!^-\'', in-
@@ -101,8 +99,32 @@
 #  define WILDCHAR   '?'
 #  define BEG_RANGE  '['
 #  define END_RANGE  ']'
+#  define WILDCHR_SINGLE '?'
+#  define DIRSEP_CHR '/'
+#  define WILDCHR_MULTI '*'
 #endif

+#ifdef WILD_STOP_AT_DIR
+   int wild_stop_at_dir = 1; /* default wildcards do not include / in matches */
+#else
+   int wild_stop_at_dir = 0; /* default wildcards do include / in matches */
+#endif
+
+
+
+/*
+ * case mapping functions. case_map is used to ignore case in comparisons,
+ * to_up is used to force upper case even on Unix (for dosify option).
+ */
+#ifdef USE_CASE_MAP
+#  define case_map(c) upper[(c) & 0xff]
+#  define to_up(c)    upper[(c) & 0xff]
+#else
+#  define case_map(c) (c)
+#  define to_up(c)    ((c) >= 'a' && (c) <= 'z' ? (c)-'a'+'A' : (c))
+#endif /* USE_CASE_MAP */
+
+
 #if 0                /* GRR:  add this to unzip.h someday... */
 #if !(defined(MSDOS) && defined(DOSWILD))
 #ifdef WILD_STOP_AT_DIR
@@ -114,8 +136,8 @@ int recmatch OF((ZCONST uch *pattern, ZC
                  int ignore_case __WDLPRO));
 #endif
 #endif /* 0 */
-static int recmatch OF((ZCONST uch *pattern, ZCONST uch *string,
-                        int ignore_case __WDLPRO));
+static int recmatch OF((ZCONST char *, ZCONST char *,
+                        int));
 static char *isshexp OF((ZCONST char *p));
 static int namecmp OF((ZCONST char *s1, ZCONST char *s2));

@@ -154,192 +176,240 @@ int match(string, pattern, ignore_case _
             }
             dospattern[j-1] = '\0';                    /* nuke the end "." */
         }
-        j = recmatch((uch *)dospattern, (uch *)string, ignore_case __WDL);
+        j = recmatch(dospattern, string, ignore_case);
         free(dospattern);
         return j == 1;
     } else
 #endif /* MSDOS && DOSWILD */
-    return recmatch((uch *)pattern, (uch *)string, ignore_case __WDL) == 1;
+    return recmatch(pattern, string, ignore_case) == 1;
 }

+#ifdef _MBCS
+
+char *___tmp_ptr;

+#endif

-static int recmatch(p, s, ic __WDL)
-    ZCONST uch *p;        /* sh pattern to match */
-    ZCONST uch *s;        /* string to which to match it */
-    int ic;               /* true for case insensitivity */
-    __WDLDEF              /* directory sepchar for WildStopAtDir mode, or 0 */
+static int recmatch(p, s, cs)
+ZCONST char *p;         /* sh pattern to match */
+ZCONST char *s;         /* string to match it to */
+int cs;                 /* flag: force case-sensitive matching */
 /* Recursively compare the sh pattern p with the string s and return 1 if
- * they match, and 0 or 2 if they don't or if there is a syntax error in the
- * pattern.  This routine recurses on itself no more deeply than the number
- * of characters in the pattern. */
+   they match, and 0 or 2 if they don't or if there is a syntax error in the
+   pattern.  This routine recurses on itself no deeper than the number of
+   characters in the pattern. */
 {
-    unsigned int c;       /* pattern char or start of range in [-] loop */
+  int c;                /* pattern char or start of range in [-] loop */
+  /* Get first character, the pattern for new recmatch calls follows */
+ /* borrowed from Zip's global.c */
+ int no_wild = 0;
+ int allow_regex=1;
+  /* This fix provided by akt@m5.dion.ne.jp for Japanese.
+     See 21 July 2006 mail.
+     It only applies when p is pointing to a doublebyte character and
+     things like / and wildcards are not doublebyte.  This probably
+     should not be needed. */

-    /* Get first character, the pattern for new recmatch calls follows */
-    c = *p; INCSTR(p);
+#ifdef _MBCS
+  if (CLEN(p) == 2) {
+    if (CLEN(s) == 2) {
+      return (*p == *s && *(p+1) == *(s+1)) ?
+        recmatch(p + 2, s + 2, cs) : 0;
+    } else {
+      return 0;
+    }
+  }
+#endif /* ?_MBCS */

-    /* If that was the end of the pattern, match if string empty too */
-    if (c == 0)
-        return *s == 0;
+  c = *POSTINCSTR(p);

-    /* '?' (or '%') matches any character (but not an empty string). */
-    if (c == WILDCHAR)
-#ifdef WILD_STOP_AT_DIR
-        /* If uO.W_flag is non-zero, it won't match '/' */
-        return (*s && (!sepc || *s != (uch)sepc))
-               ? recmatch(p, s + CLEN(s), ic, sepc) : 0;
-#else
-        return *s ? recmatch(p, s + CLEN(s), ic) : 0;
-#endif
+  /* If that was the end of the pattern, match if string empty too */
+  if (c == 0)
+    return *s == 0;
+
+  /* '?' (or '%' or '#') matches any character (but not an empty string) */
+  if (c == WILDCHR_SINGLE) {
+    if (wild_stop_at_dir)
+      return (*s && *s != DIRSEP_CHR) ? recmatch(p, s + CLEN(s), cs) : 0;
+    else
+      return *s ? recmatch(p, s + CLEN(s), cs) : 0;
+  }

-    /* '*' matches any number of characters, including zero */
+  /* WILDCHR_MULTI ('*') matches any number of characters, including zero */
 #ifdef AMIGA
-    if (c == '#' && *p == '?')     /* "#?" is Amiga-ese for "*" */
-        c = '*', p++;
+  if (!no_wild && c == '#' && *p == '?')            /* "#?" is Amiga-ese for "*" */
+    c = WILDCHR_MULTI, p++;
 #endif /* AMIGA */
-    if (c == '*') {
-#ifdef WILD_STOP_AT_DIR
-        if (sepc) {
-          /* check for single "*" or double "**" */
-#  ifdef AMIGA
-          if ((c = p[0]) == '#' && p[1] == '?') /* "#?" is Amiga-ese for "*" */
-            c = '*', p++;
-          if (c != '*') {
-#  else /* !AMIGA */
-          if (*p != '*') {
-#  endif /* ?AMIGA */
-            /* single "*": this doesn't match the dirsep character */
-            for (; *s && *s != (uch)sepc; INCSTR(s))
-                if ((c = recmatch(p, s, ic, sepc)) != 0)
-                    return (int)c;
-            /* end of pattern: matched if at end of string, else continue */
-            if (*p == '\0')
-                return (*s == 0);
-            /* continue to match if at sepc in pattern, else give up */
-            return (*p == (uch)sepc || (*p == '\\' && p[1] == (uch)sepc))
-                   ? recmatch(p, s, ic, sepc) : 2;
-          }
-          /* "**": this matches slashes */
-          ++p;        /* move p behind the second '*' */
-          /* and continue with the non-W_flag code variant */
-        }
-#endif /* WILD_STOP_AT_DIR */
+  if (!no_wild && c == WILDCHR_MULTI)
+  {
+    if (wild_stop_at_dir) {
+      /* Check for an immediately following WILDCHR_MULTI */
+# ifdef AMIGA
+      if ((c = p[0]) == '#' && p[1] == '?') /* "#?" is Amiga-ese for "*" */
+        c = WILDCHR_MULTI, p++;
+      if (c != WILDCHR_MULTI) {
+# else /* !AMIGA */
+      if (*p != WILDCHR_MULTI) {
+# endif /* ?AMIGA */
+        /* Single WILDCHR_MULTI ('*'): this doesn't match slashes */
+        for (; *s && *s != DIRSEP_CHR; INCSTR(s))
+          if ((c = recmatch(p, s, cs)) != 0)
+            return c;
+        /* end of pattern: matched if at end of string, else continue */
         if (*p == 0)
-            return 1;
-        if (isshexp((ZCONST char *)p) == NULL) {
-            /* Optimization for rest of pattern being a literal string:
-             * If there are no other shell expression chars in the rest
-             * of the pattern behind the multi-char wildcard, then just
-             * compare the literal string tail.
-             */
-            ZCONST uch *srest;
-
-            srest = s + (strlen((ZCONST char *)s) - strlen((ZCONST char *)p));
-            if (srest - s < 0)
-                /* remaining literal string from pattern is longer than rest
-                 * of test string, there can't be a match
-                 */
-                return 0;
-            else
-              /* compare the remaining literal pattern string with the last
-               * bytes of the test string to check for a match
-               */
+          return (*s == 0);
+        /* continue to match if at DIRSEP_CHR in pattern, else give up */
+        return (*p == DIRSEP_CHR || (*p == '\\' && p[1] == DIRSEP_CHR))
+               ? recmatch(p, s, cs) : 2;
+      }
+      /* Two consecutive WILDCHR_MULTI ("**"): this matches DIRSEP_CHR ('/') */
+      p++;        /* move p past the second WILDCHR_MULTI */
+      /* continue with the normal non-WILD_STOP_AT_DIR code */
+    } /* wild_stop_at_dir */
+
+    /* Not wild_stop_at_dir */
+    if (*p == 0)
+      return 1;
+    if (!isshexp((char *)p))
+    {
+      /* optimization for rest of pattern being a literal string */
+
+      /* optimization to handle patterns like *.txt */
+      /* if the first char in the pattern is '*' and there */
+      /* are no other shell expression chars, i.e. a literal string */
+      /* then just compare the literal string at the end */
+
+      ZCONST char *srest;
+
+      srest = s + (strlen(s) - strlen(p));
+      if (srest - s < 0)
+        /* remaining literal string from pattern is longer than rest of
+           test string, there can't be a match
+         */
+        return 0;
+      else
+        /* compare the remaining literal pattern string with the last bytes
+           of the test string to check for a match */
 #ifdef _MBCS
-            {
-                ZCONST uch *q = s;
+      {
+        ZCONST char *q = s;

-                /* MBCS-aware code must not scan backwards into a string from
-                 * the end.
-                 * So, we have to move forward by character from our well-known
-                 * character position s in the test string until we have
-                 * advanced to the srest position.
-                 */
-                while (q < srest)
-                  INCSTR(q);
-                /* In case the byte *srest is a trailing byte of a multibyte
-                 * character in the test string s, we have actually advanced
-                 * past the position (srest).
-                 * For this case, the match has failed!
-                 */
-                if (q != srest)
-                    return 0;
-                return ((ic
-                         ? namecmp((ZCONST char *)p, (ZCONST char *)q)
-                         : strcmp((ZCONST char *)p, (ZCONST char *)q)
-                        ) == 0);
-            }
+        /* MBCS-aware code must not scan backwards into a string from
+         * the end.
+         * So, we have to move forward by character from our well-known
+         * character position s in the test string until we have advanced
+         * to the srest position.
+         */
+        while (q < srest)
+          INCSTR(q);
+        /* In case the byte *srest is a trailing byte of a multibyte
+         * character, we have actually advanced past the position (srest).
+         * For this case, the match has failed!
+         */
+        if (q != srest)
+          return 0;
+        return ((cs ? strcmp(p, q) : namecmp(p, q)) == 0);
+      }
 #else /* !_MBCS */
-                return ((ic
-                         ? namecmp((ZCONST char *)p, (ZCONST char *)srest)
-                         : strcmp((ZCONST char *)p, (ZCONST char *)srest)
-                        ) == 0);
+        return ((cs ? strcmp(p, srest) : namecmp(p, srest)) == 0);
 #endif /* ?_MBCS */
-        } else {
-            /* pattern contains more wildcards, continue with recursion... */
-            for (; *s; INCSTR(s))
-                if ((c = recmatch(p, s, ic __WDL)) != 0)
-                    return (int)c;
-            return 2;  /* 2 means give up--match will return false */
-        }
     }
-
-    /* Parse and process the list of characters and ranges in brackets */
-    if (c == BEG_RANGE) {
-        int e;          /* flag true if next char to be taken literally */
-        ZCONST uch *q;  /* pointer to end of [-] group */
-        int r;          /* flag true to match anything but the range */
-
-        if (*s == 0)                            /* need a character to match */
-            return 0;
-        p += (r = (*p == '!' || *p == '^'));    /* see if reverse */
-        for (q = p, e = 0; *q; INCSTR(q))       /* find closing bracket */
-            if (e)
-                e = 0;
-            else
-                if (*q == '\\')      /* GRR:  change to ^ for MS-DOS, OS/2? */
-                    e = 1;
-                else if (*q == END_RANGE)
-                    break;
-        if (*q != END_RANGE)         /* nothing matches if bad syntax */
-            return 0;
-        for (c = 0, e = (*p == '-'); p < q; INCSTR(p)) {
-            /* go through the list */
-            if (!e && *p == '\\')               /* set escape flag if \ */
-                e = 1;
-            else if (!e && *p == '-')           /* set start of range if - */
-                c = *(p-1);
-            else {
-                unsigned int cc = Case(*s);
-
-                if (*(p+1) != '-')
-                    for (c = c ? c : *p; c <= *p; c++)  /* compare range */
-                        if ((unsigned)Case(c) == cc) /* typecast for MSC bug */
-                            return r ? 0 : recmatch(q + 1, s + 1, ic __WDL);
-                c = e = 0;   /* clear range, escape flags */
-            }
-        }
-        return r ? recmatch(q + CLEN(q), s + CLEN(s), ic __WDL) : 0;
-                                        /* bracket match failed */
+    else
+    {
+      /* pattern contains more wildcards, continue with recursion... */
+      for (; *s; INCSTR(s))
+        if ((c = recmatch(p, s, cs)) != 0)
+          return c;
+      return 2;           /* 2 means give up--shmatch will return false */
     }
+  }

-    /* if escape ('\\'), just compare next character */
-    if (c == '\\' && (c = *p++) == 0)     /* if \ at end, then syntax error */
-        return 0;
+#ifndef VMS             /* No bracket matching in VMS */
+  /* Parse and process the list of characters and ranges in brackets */
+  if (!no_wild && allow_regex && c == '[')
+  {
+    int e;              /* flag true if next char to be taken literally */
+    ZCONST char *q;     /* pointer to end of [-] group */
+    int r;              /* flag true to match anything but the range */
+
+    if (*s == 0)                        /* need a character to match */
+      return 0;
+    p += (r = (*p == '!' || *p == '^')); /* see if reverse */
+    for (q = p, e = 0; *q; q++)         /* find closing bracket */
+      if (e)
+        e = 0;
+      else
+        if (*q == '\\')
+          e = 1;
+        else if (*q == ']')
+          break;
+    if (*q != ']')                      /* nothing matches if bad syntax */
+      return 0;
+    for (c = 0, e = *p == '-'; p < q; p++)      /* go through the list */
+    {
+      if (e == 0 && *p == '\\')         /* set escape flag if \ */
+        e = 1;
+      else if (e == 0 && *p == '-')     /* set start of range if - */
+        c = *(p-1);
+      else
+      {
+        uch cc = (cs ? (uch)*s : case_map((uch)*s));
+        uch uc = (uch) c;
+        if (*(p+1) != '-')
+          for (uc = uc ? uc : (uch)*p; uc <= (uch)*p; uc++)
+            /* compare range */
+            if ((cs ? uc : case_map(uc)) == cc)
+              return r ? 0 : recmatch(q + CLEN(q), s + CLEN(s), cs);
+        c = e = 0;                      /* clear range, escape flags */
+      }
+    }
+    return r ? recmatch(q + CLEN(q), s + CLEN(s), cs) : 0;
+                                        /* bracket match failed */
+  }
+#endif /* !VMS */

-    /* just a character--compare it */
-#ifdef QDOS
-    return QMatch(Case((uch)c), Case(*s)) ?
-           recmatch(p, s + CLEN(s), ic __WDL) : 0;
-#else
-    return Case((uch)c) == Case(*s) ?
-           recmatch(p, s + CLEN(s), ic __WDL) : 0;
-#endif
+  /* If escape ('\'), just compare next character */
+  if (!no_wild && c == '\\')
+    if ((c = *p++) == '\0')             /* if \ at end, then syntax error */
+      return 0;
+
+#ifdef VMS
+  /* 2005-11-06 SMS.
+     Handle "..." wildcard in p with "." or "]" in s.
+  */
+  if ((c == '.') && (*p == '.') && (*(p+ CLEN( p)) == '.') &&
+   ((*s == '.') || (*s == ']')))
+  {
+    /* Match "...]" with "]".  Continue after "]" in both. */
+    if ((*(p+ 2* CLEN( p)) == ']') && (*s == ']'))
+      return recmatch( (p+ 3* CLEN( p)), (s+ CLEN( s)), cs);
+
+    /* Else, look for a reduced match in s, until "]" in or end of s. */
+    for (; *s && (*s != ']'); INCSTR(s))
+      if (*s == '.')
+        /* If reduced match, then continue after "..." in p, "." in s. */
+        if ((c = recmatch( (p+ CLEN( p)), s, cs)) != 0)
+          return (int)c;
+
+    /* Match "...]" with "]".  Continue after "]" in both. */
+    if ((*(p+ 2* CLEN( p)) == ']') && (*s == ']'))
+      return recmatch( (p+ 3* CLEN( p)), (s+ CLEN( s)), cs);
+
+    /* No reduced match.  Quit. */
+    return 2;
+  }
+
+#endif /* def VMS */
+
+  /* Just a character--compare it */
+  return (cs ? c == *s : case_map((uch)c) == case_map((uch)*s)) ?
+          recmatch(p, s + CLEN(s), cs) : 0;
+}

-} /* end function recmatch() */

+/*************************************************************************************************/
 static char *isshexp(p)
 ZCONST char *p;
 /* If p is a sh expression, a pointer to the first special character is


code:
Copied from Fedora.

http://pkgs.fedoraproject.org/cgit/unzip.git/plain/unzip-6.0-format-secure.patch?id=d18f821e

diff --git a/extract.c b/extract.c
index eeb2f57..a0a4929 100644
--- a/extract.c
+++ b/extract.c
@@ -472,8 +472,8 @@ int extract_or_test_files(__G)    /* return PK-type error code */
                      */
                     Info(slide, 0x401, ((char *)slide,
                       LoadFarString(CentSigMsg), j + blknum*DIR_BLKSIZ + 1));
-                    Info(slide, 0x401, ((char *)slide,
-                      LoadFarString(ReportMsg)));
+                    Info(slide, 0x401,
+                         ((char *)slide,"%s", LoadFarString(ReportMsg)));
                     error_in_archive = PK_BADERR;
                 }
                 reached_end = TRUE;     /* ...so no more left to do */
@@ -752,8 +752,8 @@ int extract_or_test_files(__G)    /* return PK-type error code */

 #ifndef SFX
     if (no_endsig_found) {                      /* just to make sure */
-        Info(slide, 0x401, ((char *)slide, LoadFarString(EndSigMsg)));
-        Info(slide, 0x401, ((char *)slide, LoadFarString(ReportMsg)));
+        Info(slide, 0x401, ((char *)slide,"%s", LoadFarString(EndSigMsg)));
+        Info(slide, 0x401, ((char *)slide,"%s", LoadFarString(ReportMsg)));
         if (!error_in_archive)       /* don't overwrite stronger error */
             error_in_archive = PK_WARN;
     }
diff --git a/list.c b/list.c
index 15e0011..f7359c3 100644
--- a/list.c
+++ b/list.c
@@ -181,7 +181,7 @@ int list_files(__G)    /* return PK-type error code */
                 Info(slide, 0x401,
                      ((char *)slide, LoadFarString(CentSigMsg), j));
                 Info(slide, 0x401,
-                     ((char *)slide, LoadFarString(ReportMsg)));
+                     ((char *)slide,"%s", LoadFarString(ReportMsg)));
                 return PK_BADERR;   /* sig not found */
             }
         }
@@ -507,7 +507,8 @@ int list_files(__G)    /* return PK-type error code */
             && (!G.ecrec.is_zip64_archive)
             && (memcmp(G.sig, end_central_sig, 4) != 0)
            ) {          /* just to make sure again */
-            Info(slide, 0x401, ((char *)slide, LoadFarString(EndSigMsg)));
+            Info(slide, 0x401,
+                 ((char *)slide,"%s", LoadFarString(EndSigMsg)));
             error_in_archive = PK_WARN;   /* didn't find sig */
         }

@@ -591,7 +592,7 @@ int get_time_stamp(__G__ last_modtime, nmember)  /* return PK-type error code */
                 Info(slide, 0x401,
                      ((char *)slide, LoadFarString(CentSigMsg), j));
                 Info(slide, 0x401,
-                     ((char *)slide, LoadFarString(ReportMsg)));
+                     ((char *)slide,"%s", LoadFarString(ReportMsg)));
                 return PK_BADERR;   /* sig not found */
             }
         }
@@ -674,7 +675,7 @@ int get_time_stamp(__G__ last_modtime, nmember)  /* return PK-type error code */
   ---------------------------------------------------------------------------*/

     if (memcmp(G.sig, end_central_sig, 4)) {    /* just to make sure again */
-        Info(slide, 0x401, ((char *)slide, LoadFarString(EndSigMsg)));
+        Info(slide, 0x401, ((char *)slide,"%s", LoadFarString(EndSigMsg)));
         error_in_archive = PK_WARN;
     }
     if (*nmember == 0L && error_in_archive <= PK_WARN)
diff --git a/zipinfo.c b/zipinfo.c
index 6e22cc8..ac5c61b 100644
--- a/zipinfo.c
+++ b/zipinfo.c
@@ -771,7 +771,7 @@ int zipinfo(__G)   /* return PK-type error code */
                 Info(slide, 0x401,
                      ((char *)slide, LoadFarString(CentSigMsg), j));
                 Info(slide, 0x401,
-                     ((char *)slide, LoadFarString(ReportMsg)));
+                     ((char *)slide,"%s", LoadFarString(ReportMsg)));
                 error_in_archive = PK_BADERR;   /* sig not found */
                 break;
             }
@@ -960,7 +960,8 @@ int zipinfo(__G)   /* return PK-type error code */
             && (!G.ecrec.is_zip64_archive)
             && (memcmp(G.sig, end_central_sig, 4) != 0)
            ) {          /* just to make sure again */
-            Info(slide, 0x401, ((char *)slide, LoadFarString(EndSigMsg)));
+            Info(slide, 0x401,
+                 ((char *)slide,"%s", LoadFarString(EndSigMsg)));
             error_in_archive = PK_WARN;   /* didn't find sig */
         }

repo_name: maximed/guix

license: mit


code:
Copied from Debian.

From: Andreas Schwab <schwab@linux-m68k.org>
Subject: Initialize the symlink flag
Bug-Debian: http://bugs.debian.org/717029
X-Debian-version: 6.0-10

--- a/process.c
+++ b/process.c
@@ -1758,6 +1758,12 @@
         = (G.crec.general_purpose_bit_flag & (1 << 11)) == (1 << 11);
 #endif

+#ifdef SYMLINKS
+    /* Initialize the symlink flag, may be set by the platform-specific
+       mapattr function.  */
+    G.pInfo->symlink = 0;
+#endif
+
     return PK_COOL;

 } /* end function process_cdir_file_hdr() */


code:
--- unzip60/man/unzip.1	2011-01-11 11:59:59.000000000 +0000
+++ unzip60/man/unzip_new	2011-02-05 18:45:55.000000000 +0000
@@ -424,7 +424,7 @@
 .\" Amiga support possible eventually, but not yet
 [MS-DOS, OS/2, NT] restore the volume label if the extraction medium is
 removable (e.g., a diskette).  Doubling the option (\fB\-$$\fP) allows fixed
-media (hard disks) to be labelled as well.  By default, volume labels are
+media (hard disks) to be labeled as well.  By default, volume labels are
 ignored.
 .IP \fB\-/\fP\ \fIextensions\fP
 [Acorn only] overrides the extension list supplied by Unzip$Ext environment


code:
Copied from Fedora.

http://pkgs.fedoraproject.org/cgit/unzip.git/plain/unzip-6.0-overflow-long-fsize.patch?id=d18f821e

diff --git a/list.c b/list.c
index f7359c3..4c3d703 100644
--- a/list.c
+++ b/list.c
@@ -97,7 +97,7 @@ int list_files(__G)    /* return PK-type error code */
 {
     int do_this_file=FALSE, cfactor, error, error_in_archive=PK_COOL;
 #ifndef WINDLL
-    char sgn, cfactorstr[10];
+    char sgn, cfactorstr[13];
     int longhdr=(uO.vflag>1);
 #endif
     int date_format;
@@ -339,7 +339,19 @@ int list_files(__G)    /* return PK-type error code */
                 G.crec.compression_method == ENHDEFLATED) {
                 methbuf[5] = dtype[(G.crec.general_purpose_bit_flag>>1) & 3];
             } else if (methnum >= NUM_METHODS) {
-                sprintf(&methbuf[4], "%03u", G.crec.compression_method);
+                /* 2013-02-26 SMS.
+                 * http://sourceforge.net/tracker/?func=detail
+                 *  &aid=2861648&group_id=118012&atid=679786
+                 * Unexpectedly large compression methods overflow
+                 * &methbuf[].  Use the old, three-digit decimal format
+                 * for values which fit.  Otherwise, sacrifice the
+                 * colon, and use four-digit hexadecimal.
+                 */
+                if (G.crec.compression_method <= 999) {
+                    sprintf( &methbuf[ 4], "%03u", G.crec.compression_method);
+                } else {
+                    sprintf( &methbuf[ 3], "%04X", G.crec.compression_method);
+                }
             }

 #if 0       /* GRR/Euro:  add this? */


code:
Extracted from a patch in Fedora.

http://pkgs.fedoraproject.org/cgit/unzip.git/tree/unzip-6.0-heap-overflow-infloop.patch?id=d18f821e

From bd150334fb4084f5555a6be26b015a0671cb5b74 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Tue, 22 Sep 2015 18:52:23 +0200
Subject: [PATCH 3/3] extract: prevent unsigned overflow on invalid input

Suggested-by: Stefan Cornelius
---
 extract.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/extract.c b/extract.c
index 29db027..b9ae667 100644
--- a/extract.c
+++ b/extract.c
@@ -1257,8 +1257,17 @@ static int extract_or_test_entrylist(__G__ numchunk,
         if (G.lrec.compression_method == STORED) {
             zusz_t csiz_decrypted = G.lrec.csize;

-            if (G.pInfo->encrypted)
+            if (G.pInfo->encrypted) {
+                if (csiz_decrypted <= 12) {
+                    /* handle the error now to prevent unsigned overflow */
+                    Info(slide, 0x401, ((char *)slide,
+                      LoadFarStringSmall(ErrUnzipNoFile),
+                      LoadFarString(InvalidComprData),
+                      LoadFarStringSmall2(Inflate)));
+                    return PK_ERR;
+                }
                 csiz_decrypted -= 12;
+            }
             if (G.lrec.ucsize != csiz_decrypted) {
                 Info(slide, 0x401, ((char *)slide,
                   LoadFarStringSmall2(WrnStorUCSizCSizDiff),
--
2.5.2


code:
diff --git a/extract.c b/extract.c
index a0a4929..9ef80b3 100644
--- a/extract.c
+++ b/extract.c
@@ -2214,6 +2214,7 @@ static int test_compr_eb(__G__ eb, eb_size, compr_offset, test_uc_ebdata)
     ulg eb_ucsize;
     uch *eb_ucptr;
     int r;
+    ush method;

     if (compr_offset < 4)                /* field is not compressed: */
         return PK_OK;                    /* do nothing and signal OK */
@@ -2223,6 +2224,12 @@ static int test_compr_eb(__G__ eb, eb_size, compr_offset, test_uc_ebdata)
          eb_size <= (compr_offset + EB_CMPRHEADLEN)))
         return IZ_EF_TRUNC;               /* no compressed data! */

+    method = makeword(eb + (EB_HEADSIZE + compr_offset));
+    if ((method == STORED) && (eb_size != compr_offset + EB_CMPRHEADLEN + eb_ucsize))
+        return PK_ERR;            /* compressed & uncompressed
+                                   * should match in STORED
+                                   * method */
+
     if (
 #ifdef INT_16BIT
         (((ulg)(extent)eb_ucsize) != eb_ucsize) ||


code:
Copied from Debian.

From: Jérémy Bobbio <lunar@debian.org>
Subject: Remove build date
Bug-Debian: http://bugs.debian.org/782851
 In order to make unzip build reproducibly, we remove the
 (already optional) build date from the binary.

--- a/unix/unix.c
+++ b/unix/unix.c
@@ -1705,7 +1705,7 @@
 #endif /* Sun */
 #endif /* SGI */

-#ifdef __DATE__
+#if 0
       " on ", __DATE__
 #else
       "", ""


code:
From: "Steven M. Schweda" <sms@antinode.info>
Subject: Do not ignore extra fields containing Unix Timestamps
Bug-Debian: https://bugs.debian.org/842993
X-Debian-version: 6.0-21

--- a/process.c
+++ b/process.c
@@ -2914,10 +2914,13 @@
             break;

           case EF_IZUNIX2:
-            if (have_new_type_eb == 0) {
-                flags &= ~0x0ff;        /* ignore any previous IZUNIX field */
+            if (have_new_type_eb == 0) {        /* (< 1) */
                 have_new_type_eb = 1;
             }
+            if (have_new_type_eb <= 1) {
+                /* Ignore any prior (EF_IZUNIX/EF_PKUNIX) UID/GID. */
+                flags &= 0x0ff;
+            }
 #ifdef IZ_HAVE_UXUIDGID
             if (have_new_type_eb > 1)
                 break;          /* IZUNIX3 overrides IZUNIX2 e.f. block ! */
@@ -2933,6 +2936,8 @@
             /* new 3rd generation Unix ef */
             have_new_type_eb = 2;

+            /* Ignore any prior EF_IZUNIX/EF_PKUNIX/EF_IZUNIX2 UID/GID. */
+            flags &= 0x0ff;
         /*
           Version       1 byte      version of this extra field, currently 1
           UIDSize       1 byte      Size of UID field
@@ -2953,8 +2958,6 @@
                 uid_size = *((EB_HEADSIZE + 1) + ef_buf);
                 gid_size = *((EB_HEADSIZE + uid_size + 2) + ef_buf);

-                flags &= ~0x0ff;      /* ignore any previous UNIX field */
-
                 if ( read_ux3_value((EB_HEADSIZE + 2) + ef_buf,
                                     uid_size, &z_uidgid[0])
                     &&


code:
diff --git a/fileio.c b/fileio.c
index ba0a1d0..03fc4be 100644
--- a/fileio.c
+++ b/fileio.c
@@ -2006,6 +2006,7 @@ int do_string(__G__ length, option)   /* return PK-type error code */
     unsigned comment_bytes_left;
     unsigned int block_len;
     int error=PK_OK;
+    unsigned int length2;
 #ifdef AMIGA
     char tmp_fnote[2 * AMIGA_FILENOTELEN];   /* extra room for squozen chars */
 #endif
@@ -2292,8 +2293,12 @@ int do_string(__G__ length, option)   /* return PK-type error code */
             seek_zipf(__G__ G.cur_zipfile_bufstart - G.extra_bytes +
                       (G.inptr-G.inbuf) + length);
         } else {
-            if (readbuf(__G__ (char *)G.extra_field, length) == 0)
+            if ((length2 = readbuf(__G__ (char *)G.extra_field, length)) == 0)
                 return PK_EOF;
+            if(length2 < length) {
+              memset (__G__ (char *)G.extra_field+length2, 0 , length-length2);
+              length = length2;
+            }
             /* Looks like here is where extra fields are read */
             getZip64Data(__G__ G.extra_field, length);
 #ifdef UNICODE_SUPPORT


code:
--- ./process.c.orig    2009-03-06 02:25:10.000000000 +0100
+++ ./process.c 2013-09-12 10:51:16.000000000 +0200
@@ -2901,9 +2901,9 @@
         */

 #ifdef IZ_HAVE_UXUIDGID
-            if (eb_len >= EB_UX3_MINLEN
-                && z_uidgid != NULL
-                && (*((EB_HEADSIZE + 0) + ef_buf) == 1)
+            if ((eb_len >= EB_UX3_MINLEN)
+                && (z_uidgid != NULL)
+                && ((*((EB_HEADSIZE + 0) + ef_buf) == 1)))
                     /* only know about version 1 */
             {
                 uch uid_size;
@@ -2915,10 +2915,10 @@
                 flags &= ~0x0ff;      /* ignore any previous UNIX field */

                 if ( read_ux3_value((EB_HEADSIZE + 2) + ef_buf,
-                                    uid_size, z_uidgid[0])
+                                    uid_size, &z_uidgid[0])
                     &&
                      read_ux3_value((EB_HEADSIZE + uid_size + 3) + ef_buf,
-                                    gid_size, z_uidgid[1]) )
+                                    gid_size, &z_uidgid[1]) )
                 {
                     flags |= EB_UX2_VALID;   /* signal success */
                 }


code:
From 6fe72291a5563cdbcd2bdd87e36528537b7cdcfb Mon Sep 17 00:00:00 2001
From: Jakub Martisko <jamartis@redhat.com>
Date: Mon, 18 Nov 2019 14:17:46 +0100
Subject: [PATCH] update the man page

---
 man/unzip.1 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/man/unzip.1 b/man/unzip.1
index 21816d1..4d66073 100644
--- a/man/unzip.1
+++ b/man/unzip.1
@@ -850,6 +850,8 @@ the specified zipfiles were not found.
 invalid options were specified on the command line.
 .IP 11
 no matching files were found.
+.IP 12
+invalid zip file with overlapped components (possible zip bomb).
 .IP 50
 the disk is (or was) full during extraction.
 .IP 51
--
2.23.0


code:
From 41beb477c5744bc396fa1162ee0c14218ec12213 Mon Sep 17 00:00:00 2001
From: Mark Adler <madler@alumni.caltech.edu>
Date: Mon, 27 May 2019 08:20:32 -0700
Subject: [PATCH] Fix bug in undefer_input() that misplaced the input state.

---
 fileio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fileio.c b/fileio.c
index c042987..bc00d74 100644
--- a/fileio.c
+++ b/fileio.c
@@ -530,8 +530,10 @@ void undefer_input(__G)
          * This condition was checked when G.incnt_leftover was set > 0 in
          * defer_leftover_input(), and it is NOT allowed to touch G.csize
          * before calling undefer_input() when (G.incnt_leftover > 0)
-         * (single exception: see read_byte()'s  "G.csize <= 0" handling) !!
+         * (single exception: see readbyte()'s  "G.csize <= 0" handling) !!
          */
+        if (G.csize < 0L)
+            G.csize = 0L;
         G.incnt = G.incnt_leftover + (int)G.csize;
         G.inptr = G.inptr_leftover - (int)G.csize;
         G.incnt_leftover = 0;


code:
From 47b3ceae397d21bf822bc2ac73052a4b1daf8e1c Mon Sep 17 00:00:00 2001
From: Mark Adler <madler@alumni.caltech.edu>
Date: Tue, 11 Jun 2019 22:01:18 -0700
Subject: [PATCH] Detect and reject a zip bomb using overlapped entries.

This detects an invalid zip file that has at least one entry that
overlaps with another entry or with the central directory to the
end of the file. A Fifield zip bomb uses overlapped local entries
to vastly increase the potential inflation ratio. Such an invalid
zip file is rejected.

See https://www.bamsoftware.com/hacks/zipbomb/ for David Fifield's
analysis, construction, and examples of such zip bombs.

The detection maintains a list of covered spans of the zip files
so far, where the central directory to the end of the file and any
bytes preceding the first entry at zip file offset zero are
considered covered initially. Then as each entry is decompressed
or tested, it is considered covered. When a new entry is about to
be processed, its initial offset is checked to see if it is
contained by a covered span. If so, the zip file is rejected as
invalid.

This commit depends on a preceding commit: "Fix bug in
undefer_input() that misplaced the input state."
---
 extract.c | 190 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 globals.c |   1 +
 globals.h |   3 +
 process.c |  11 ++++
 unzip.h   |   1 +
 5 files changed, 205 insertions(+), 1 deletion(-)

diff --git a/extract.c b/extract.c
index 1acd769..0973a33 100644
--- a/extract.c
+++ b/extract.c
@@ -319,6 +319,125 @@ static ZCONST char Far UnsupportedExtraField[] =
   "\nerror:  unsupported extra-field compression type (%u)--skipping\n";
 static ZCONST char Far BadExtraFieldCRC[] =
   "error [%s]:  bad extra-field CRC %08lx (should be %08lx)\n";
+static ZCONST char Far NotEnoughMemCover[] =
+  "error: not enough memory for bomb detection\n";
+static ZCONST char Far OverlappedComponents[] =
+  "error: invalid zip file with overlapped components (possible zip bomb)\n";
+
+
+
+
+
+/* A growable list of spans. */
+typedef zoff_t bound_t;
+typedef struct {
+    bound_t beg;        /* start of the span */
+    bound_t end;        /* one past the end of the span */
+} span_t;
+typedef struct {
+    span_t *span;       /* allocated, distinct, and sorted list of spans */
+    size_t num;         /* number of spans in the list */
+    size_t max;         /* allocated number of spans (num <= max) */
+} cover_t;
+
+/*
+ * Return the index of the first span in cover whose beg is greater than val.
+ * If there is no such span, then cover->num is returned.
+ */
+static size_t cover_find(cover, val)
+    cover_t *cover;
+    bound_t val;
+{
+    size_t lo = 0, hi = cover->num;
+    while (lo < hi) {
+        size_t mid = (lo + hi) >> 1;
+        if (val < cover->span[mid].beg)
+            hi = mid;
+        else
+            lo = mid + 1;
+    }
+    return hi;
+}
+
+/* Return true if val lies within any one of the spans in cover. */
+static int cover_within(cover, val)
+    cover_t *cover;
+    bound_t val;
+{
+    size_t pos = cover_find(cover, val);
+    return pos > 0 && val < cover->span[pos - 1].end;
+}
+
+/*
+ * Add a new span to the list, but only if the new span does not overlap any
+ * spans already in the list. The new span covers the values beg..end-1. beg
+ * must be less than end.
+ *
+ * Keep the list sorted and merge adjacent spans. Grow the allocated space for
+ * the list as needed. On success, 0 is returned. If the new span overlaps any
+ * existing spans, then 1 is returned and the new span is not added to the
+ * list. If the new span is invalid because beg is greater than or equal to
+ * end, then -1 is returned. If the list needs to be grown but the memory
+ * allocation fails, then -2 is returned.
+ */
+static int cover_add(cover, beg, end)
+    cover_t *cover;
+    bound_t beg;
+    bound_t end;
+{
+    size_t pos;
+    int prec, foll;
+
+    if (beg >= end)
+    /* The new span is invalid. */
+        return -1;
+
+    /* Find where the new span should go, and make sure that it does not
+       overlap with any existing spans. */
+    pos = cover_find(cover, beg);
+    if ((pos > 0 && beg < cover->span[pos - 1].end) ||
+        (pos < cover->num && end > cover->span[pos].beg))
+        return 1;
+
+    /* Check for adjacencies. */
+    prec = pos > 0 && beg == cover->span[pos - 1].end;
+    foll = pos < cover->num && end == cover->span[pos].beg;
+    if (prec && foll) {
+        /* The new span connects the preceding and following spans. Merge the
+           following span into the preceding span, and delete the following
+           span. */
+        cover->span[pos - 1].end = cover->span[pos].end;
+        cover->num--;
+        memmove(cover->span + pos, cover->span + pos + 1,
+                (cover->num - pos) * sizeof(span_t));
+    }
+    else if (prec)
+        /* The new span is adjacent only to the preceding span. Extend the end
+           of the preceding span. */
+        cover->span[pos - 1].end = end;
+    else if (foll)
+        /* The new span is adjacent only to the following span. Extend the
+           beginning of the following span. */
+        cover->span[pos].beg = beg;
+    else {
+        /* The new span has gaps between both the preceding and the following
+           spans. Assure that there is room and insert the span.  */
+        if (cover->num == cover->max) {
+            size_t max = cover->max == 0 ? 16 : cover->max << 1;
+            span_t *span = realloc(cover->span, max * sizeof(span_t));
+            if (span == NULL)
+                return -2;
+            cover->span = span;
+            cover->max = max;
+        }
+        memmove(cover->span + pos + 1, cover->span + pos,
+                (cover->num - pos) * sizeof(span_t));
+        cover->num++;
+        cover->span[pos].beg = beg;
+        cover->span[pos].end = end;
+    }
+    return 0;
+}

@@ -374,6 +493,29 @@ int extract_or_test_files(__G)    /* return PK-type error code */
     }
 #endif /* !SFX || SFX_EXDIR */

+    /* One more: initialize cover structure for bomb detection. Start with a
+       span that covers the central directory though the end of the file. */
+    if (G.cover == NULL) {
+        G.cover = malloc(sizeof(cover_t));
+        if (G.cover == NULL) {
+            Info(slide, 0x401, ((char *)slide,
+              LoadFarString(NotEnoughMemCover)));
+            return PK_MEM;
+        }
+        ((cover_t *)G.cover)->span = NULL;
+        ((cover_t *)G.cover)->max = 0;
+    }
+    ((cover_t *)G.cover)->num = 0;
+    if ((G.extra_bytes != 0 &&
+         cover_add((cover_t *)G.cover, 0, G.extra_bytes) != 0) ||
+        cover_add((cover_t *)G.cover,
+                  G.extra_bytes + G.ecrec.offset_start_central_directory,
+                  G.ziplen) != 0) {
+        Info(slide, 0x401, ((char *)slide,
+          LoadFarString(NotEnoughMemCover)));
+        return PK_MEM;
+    }
+
 /*---------------------------------------------------------------------------
     The basic idea of this function is as follows.  Since the central di-
     rectory lies at the end of the zipfile and the member files lie at the
@@ -591,7 +733,8 @@ int extract_or_test_files(__G)    /* return PK-type error code */
             if (error > error_in_archive)
                 error_in_archive = error;
             /* ...and keep going (unless disk full or user break) */
-            if (G.disk_full > 1 || error_in_archive == IZ_CTRLC) {
+            if (G.disk_full > 1 || error_in_archive == IZ_CTRLC ||
+                error == PK_BOMB) {
                 /* clear reached_end to signal premature stop ... */
                 reached_end = FALSE;
                 /* ... and cancel scanning the central directory */
@@ -1060,6 +1203,11 @@ static int extract_or_test_entrylist(__G__ numchunk,

         /* seek_zipf(__G__ pInfo->offset);  */
         request = G.pInfo->offset + G.extra_bytes;
+        if (cover_within((cover_t *)G.cover, request)) {
+            Info(slide, 0x401, ((char *)slide,
+              LoadFarString(OverlappedComponents)));
+            return PK_BOMB;
+        }
         inbuf_offset = request % INBUFSIZ;
         bufstart = request - inbuf_offset;

@@ -1591,6 +1739,18 @@ static int extract_or_test_entrylist(__G__ numchunk,
             return IZ_CTRLC;        /* cancel operation by user request */
         }
 #endif
+        error = cover_add((cover_t *)G.cover, request,
+                          G.cur_zipfile_bufstart + (G.inptr - G.inbuf));
+        if (error < 0) {
+            Info(slide, 0x401, ((char *)slide,
+              LoadFarString(NotEnoughMemCover)));
+            return PK_MEM;
+        }
+        if (error != 0) {
+            Info(slide, 0x401, ((char *)slide,
+              LoadFarString(OverlappedComponents)));
+            return PK_BOMB;
+        }
 #ifdef MACOS  /* MacOS is no preemptive OS, thus call event-handling by hand */
         UserStop();
 #endif
@@ -1992,6 +2152,34 @@ static int extract_or_test_member(__G)    /* return PK-type error code */
     }

     undefer_input(__G);
+
+    if ((G.lrec.general_purpose_bit_flag & 8) != 0) {
+        /* skip over data descriptor (harder than it sounds, due to signature
+         * ambiguity)
+         */
+#       define SIG 0x08074b50
+#       define LOW 0xffffffff
+        uch buf[12];
+        unsigned shy = 12 - readbuf((char *)buf, 12);
+        ulg crc = shy ? 0 : makelong(buf);
+        ulg clen = shy ? 0 : makelong(buf + 4);
+        ulg ulen = shy ? 0 : makelong(buf + 8); /* or high clen if ZIP64 */
+        if (crc == SIG &&                       /* if not SIG, no signature */
+            (G.lrec.crc32 != SIG ||             /* if not SIG, have signature */
+             (clen == SIG &&                    /* if not SIG, no signature */
+              ((G.lrec.csize & LOW) != SIG ||   /* if not SIG, have signature */
+               (ulen == SIG &&                  /* if not SIG, no signature */
+                (G.zip64 ? G.lrec.csize >> 32 : G.lrec.ucsize) != SIG
+                                                /* if not SIG, have signature */
+                )))))
+                   /* skip four more bytes to account for signature */
+                   shy += 4 - readbuf((char *)buf, 4);
+        if (G.zip64)
+            shy += 8 - readbuf((char *)buf, 8); /* skip eight more for ZIP64 */
+        if (shy)
+            error = PK_ERR;
+    }
+
     return error;

 } /* end function extract_or_test_member() */
diff --git a/globals.c b/globals.c
index fa8cca5..1e0f608 100644
--- a/globals.c
+++ b/globals.c
@@ -181,6 +181,7 @@ Uz_Globs *globalsCtor()
 # if (!defined(NO_TIMESTAMPS))
     uO.D_flag=1;    /* default to '-D', no restoration of dir timestamps */
 # endif
+    G.cover = NULL;     /* not allocated yet */
 #endif

     uO.lflag=(-1);
diff --git a/globals.h b/globals.h
index 11b7215..2bdcdeb 100644
--- a/globals.h
+++ b/globals.h
@@ -260,12 +260,15 @@ typedef struct Globals {
     ecdir_rec       ecrec;         /* used in unzip.c, extract.c */
     z_stat   statbuf;              /* used by main, mapname, check_for_newer */

+    int zip64;                     /* true if Zip64 info in extra field */
+
     int      mem_mode;
     uch      *outbufptr;           /* extract.c static */
     ulg      outsize;              /* extract.c static */
     int      reported_backslash;   /* extract.c static */
     int      disk_full;
     int      newfile;
+    void     **cover;              /* used in extract.c for bomb detection */

     int      didCRlast;            /* fileio static */
     ulg      numlines;             /* fileio static: number of lines printed */
diff --git a/process.c b/process.c
index 1e9a1e1..d2e4dc3 100644
--- a/process.c
+++ b/process.c
@@ -637,6 +637,13 @@ void free_G_buffers(__G)     /* releases all memory allocated in global vars */
     }
 #endif

+    /* Free the cover span list and the cover structure. */
+    if (G.cover != NULL) {
+        free(*(G.cover));
+        free(G.cover);
+        G.cover = NULL;
+    }
+
 } /* end function free_G_buffers() */

@@ -1890,6 +1897,8 @@ int getZip64Data(__G__ ef_buf, ef_len)
 #define Z64FLGS 0xffff
 #define Z64FLGL 0xffffffff

+    G.zip64 = FALSE;
+
     if (ef_len == 0 || ef_buf == NULL)
         return PK_COOL;

@@ -1927,6 +1936,8 @@ int getZip64Data(__G__ ef_buf, ef_len)
 #if 0
           break;                /* Expect only one EF_PKSZ64 block. */
 #endif /* 0 */
+
+          G.zip64 = TRUE;
         }

         /* Skip this extra field block. */
diff --git a/unzip.h b/unzip.h
index 5b2a326..ed24a5b 100644
--- a/unzip.h
+++ b/unzip.h
@@ -645,6 +645,7 @@ typedef struct _Uzp_cdir_Rec {
 #define PK_NOZIP           9   /* zipfile not found */
 #define PK_PARAM          10   /* bad or illegal parameters specified */
 #define PK_FIND           11   /* no files found */
+#define PK_BOMB           12   /* likely zip bomb */
 #define PK_DISK           50   /* disk full */
 #define PK_EOF            51   /* unexpected EOF */


code:
From 6d351831be705cc26d897db44f878a978f4138fc Mon Sep 17 00:00:00 2001
From: Mark Adler <madler@alumni.caltech.edu>
Date: Thu, 25 Jul 2019 20:43:17 -0700
Subject: [PATCH] Do not raise a zip bomb alert for a misplaced central
 directory.

There is a zip-like file in the Firefox distribution, omni.ja,
which is a zip container with the central directory placed at the
start of the file instead of after the local entries as required
by the zip standard. This commit marks the actual location of the
central directory, as well as the end of central directory records,
as disallowed locations. This now permits such containers to not
raise a zip bomb alert, where in fact there are no overlaps.
---
 extract.c | 25 +++++++++++++++++++------
 process.c |  6 ++++++
 unzpriv.h | 10 ++++++++++
 3 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/extract.c b/extract.c
index 0973a33..1b73cb0 100644
--- a/extract.c
+++ b/extract.c
@@ -493,8 +493,11 @@ int extract_or_test_files(__G)    /* return PK-type error code */
     }
 #endif /* !SFX || SFX_EXDIR */

-    /* One more: initialize cover structure for bomb detection. Start with a
-       span that covers the central directory though the end of the file. */
+    /* One more: initialize cover structure for bomb detection. Start with
+       spans that cover any extra bytes at the start, the central directory,
+       the end of central directory record (including the Zip64 end of central
+       directory locator, if present), and the Zip64 end of central directory
+       record, if present. */
     if (G.cover == NULL) {
         G.cover = malloc(sizeof(cover_t));
         if (G.cover == NULL) {
@@ -506,15 +509,25 @@ int extract_or_test_files(__G)    /* return PK-type error code */
         ((cover_t *)G.cover)->max = 0;
     }
     ((cover_t *)G.cover)->num = 0;
-    if ((G.extra_bytes != 0 &&
-         cover_add((cover_t *)G.cover, 0, G.extra_bytes) != 0) ||
-        cover_add((cover_t *)G.cover,
+    if (cover_add((cover_t *)G.cover,
                   G.extra_bytes + G.ecrec.offset_start_central_directory,
-                  G.ziplen) != 0) {
+                  G.extra_bytes + G.ecrec.offset_start_central_directory +
+                  G.ecrec.size_central_directory) != 0) {
         Info(slide, 0x401, ((char *)slide,
           LoadFarString(NotEnoughMemCover)));
         return PK_MEM;
     }
+    if ((G.extra_bytes != 0 &&
+         cover_add((cover_t *)G.cover, 0, G.extra_bytes) != 0) ||
+        (G.ecrec.have_ecr64 &&
+         cover_add((cover_t *)G.cover, G.ecrec.ec64_start,
+                   G.ecrec.ec64_end) != 0) ||
+        cover_add((cover_t *)G.cover, G.ecrec.ec_start,
+                  G.ecrec.ec_end) != 0) {
+        Info(slide, 0x401, ((char *)slide,
+          LoadFarString(OverlappedComponents)));
+        return PK_BOMB;
+    }

 /*---------------------------------------------------------------------------
     The basic idea of this function is as follows.  Since the central di-
diff --git a/process.c b/process.c
index d2e4dc3..d75d405 100644
--- a/process.c
+++ b/process.c
@@ -1408,6 +1408,10 @@ static int find_ecrec64(__G__ searchlen)         /* return PK-class error */

     /* Now, we are (almost) sure that we have a Zip64 archive. */
     G.ecrec.have_ecr64 = 1;
+    G.ecrec.ec_start -= ECLOC64_SIZE+4;
+    G.ecrec.ec64_start = ecrec64_start_offset;
+    G.ecrec.ec64_end = ecrec64_start_offset +
+                       12 + makeint64(&byterec[ECREC64_LENGTH]);

     /* Update the "end-of-central-dir offset" for later checks. */
     G.real_ecrec_offset = ecrec64_start_offset;
@@ -1542,6 +1546,8 @@ static int find_ecrec(__G__ searchlen)          /* return PK-class error */
       makelong(&byterec[OFFSET_START_CENTRAL_DIRECTORY]);
     G.ecrec.zipfile_comment_length =
       makeword(&byterec[ZIPFILE_COMMENT_LENGTH]);
+    G.ecrec.ec_start = G.real_ecrec_offset;
+    G.ecrec.ec_end = G.ecrec.ec_start + 22 + G.ecrec.zipfile_comment_length;

     /* Now, we have to read the archive comment, BEFORE the file pointer
        is moved away backwards to seek for a Zip64 ECLOC64 structure.
diff --git a/unzpriv.h b/unzpriv.h
index dc9eff5..297b3c7 100644
--- a/unzpriv.h
+++ b/unzpriv.h
@@ -2185,6 +2185,16 @@ typedef struct VMStimbuf {
        int have_ecr64;                  /* valid Zip64 ecdir-record exists */
        int is_zip64_archive;            /* Zip64 ecdir-record is mandatory */
        ush zipfile_comment_length;
+       zusz_t ec_start, ec_end;         /* offsets of start and end of the
+                                           end of central directory record,
+                                           including if present the Zip64
+                                           end of central directory locator,
+                                           which immediately precedes the
+                                           end of central directory record */
+       zusz_t ec64_start, ec64_end;     /* if have_ecr64 is true, then these
+                                           are the offsets of the start and
+                                           end of the Zip64 end of central
+                                           directory record */
    } ecdir_rec;


code:
From 27ae011b31d831752b97eb209bc2b2206fcf40f7 Mon Sep 17 00:00:00 2001
From: Tobias Geerinckx-Rice <me@tobias.gr>
Date: Mon, 28 Jun 2021 11:58:47 +0200
Subject: [PATCH] gnu: upower: Fix build directory.

Remove explicit set of UPOWER_CONF_FILE_NAME in up-self-test.c;
instead the harness should set it.  In Guix we set it explicitly; the
right thing is to use AM_TEST_ENVIRONMENT and regenerate the
makefiles, but we can't regenerate because current autotools carp on
some things, so we patch the Makefile.in instead.

Also fix to not try to create /var/lib/upower if /var isn't writable.

Based on a patch by Andy Wingo <wingo@igalia.com>
---
 src/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 3400139..f51ee89 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -181,7 +181,7 @@ $(systemdservice_DATA): $(systemdservice_in_files) Makefile
 endif

 install-data-hook:
-	if test -w $(DESTDIR)$(prefix)/; then \
+	if test -w $(DESTDIR)$(localstatedir)/; then \
 		mkdir -p $(DESTDIR)$(historydir); \
 	fi

--
2.32.0


code:
From 3781df9da23840e596d5e9e8493f22666802fe6c Mon Sep 17 00:00:00 2001
From: John Reiser <jreiser@BitWagon.com>
Date: Fri, 11 Dec 2020 13:38:18 -0800
Subject: [PATCH] Check DT_REL/DT_RELA, DT_RELSZ/DT_RELASZ

https://github.com/upx/upx/issues/421
	modified:   p_lx_elf.cpp
---
 src/p_lx_elf.cpp | 34 +++++++++++++++++++++++++++++-----
 1 file changed, 29 insertions(+), 5 deletions(-)

diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp
index 182db192..3a4101cf 100644
--- a/src/p_lx_elf.cpp
+++ b/src/p_lx_elf.cpp
@@ -2222,8 +2222,20 @@ bool PackLinuxElf32::canPack()
                         int z_rsz = dt_table[Elf32_Dyn::DT_RELSZ];
                         if (z_rel && z_rsz) {
                             unsigned rel_off = get_te32(&dynseg[-1+ z_rel].d_val);
+                            if ((unsigned)file_size <= rel_off) {
+                                char msg[70]; snprintf(msg, sizeof(msg),
+                                     "bad Elf32_Dynamic[DT_REL] %#x\n",
+                                     rel_off);
+                                throwCantPack(msg);
+                            }
                             Elf32_Rel *rp = (Elf32_Rel *)&file_image[rel_off];
                             unsigned relsz   = get_te32(&dynseg[-1+ z_rsz].d_val);
+                            if ((unsigned)file_size <= relsz) {
+                                char msg[70]; snprintf(msg, sizeof(msg),
+                                     "bad Elf32_Dynamic[DT_RELSZ] %#x\n",
+                                     relsz);
+                                throwCantPack(msg);
+                            }
                             Elf32_Rel *last = (Elf32_Rel *)(relsz + (char *)rp);
                             for (; rp < last; ++rp) {
                                 unsigned r_va = get_te32(&rp->r_offset);
@@ -2562,14 +2574,26 @@ PackLinuxElf64::canPack()
                         int z_rel = dt_table[Elf64_Dyn::DT_RELA];
                         int z_rsz = dt_table[Elf64_Dyn::DT_RELASZ];
                         if (z_rel && z_rsz) {
-                            unsigned rel_off = get_te64(&dynseg[-1+ z_rel].d_val);
+                            upx_uint64_t rel_off = get_te64(&dynseg[-1+ z_rel].d_val);
+                            if ((u64_t)file_size <= rel_off) {
+                                char msg[70]; snprintf(msg, sizeof(msg),
+                                     "bad Elf64_Dynamic[DT_RELA] %#llx\n",
+                                     rel_off);
+                                throwCantPack(msg);
+                            }
                             Elf64_Rela *rp = (Elf64_Rela *)&file_image[rel_off];
-                            unsigned relsz   = get_te64(&dynseg[-1+ z_rsz].d_val);
+                            upx_uint64_t relsz   = get_te64(&dynseg[-1+ z_rsz].d_val);
+                            if ((u64_t)file_size <= relsz) {
+                                char msg[70]; snprintf(msg, sizeof(msg),
+                                     "bad Elf64_Dynamic[DT_RELASZ] %#llx\n",
+                                     relsz);
+                                throwCantPack(msg);
+                            }
                             Elf64_Rela *last = (Elf64_Rela *)(relsz + (char *)rp);
                             for (; rp < last; ++rp) {
-                                unsigned r_va = get_te64(&rp->r_offset);
+                                upx_uint64_t r_va = get_te64(&rp->r_offset);
                                 if (r_va == user_init_ava) { // found the Elf64_Rela
-                                    unsigned r_info = get_te64(&rp->r_info);
+                                    upx_uint64_t r_info = get_te64(&rp->r_info);
                                     unsigned r_type = ELF64_R_TYPE(r_info);
                                     if (Elf64_Ehdr::EM_AARCH64 == e_machine
                                     &&  R_AARCH64_RELATIVE == r_type) {
@@ -2581,7 +2605,7 @@ PackLinuxElf64::canPack()
                                     }
                                     else {
                                         char msg[50]; snprintf(msg, sizeof(msg),
-                                            "bad relocation %#x DT_INIT_ARRAY[0]",
+                                            "bad relocation %#llx DT_INIT_ARRAY[0]",
                                             r_info);
                                         throwCantPack(msg);
                                     }


code:
This patch allows to compile the 'ustr' package with gcc-5.

Patch copied from Debian:

https://anonscm.debian.org/cgit/users/zito-guest/pkg-ustr.git/commit/?id=fb2528fef188b4de51a27c4f688042c36d2d7a18

From: Václav Ovsík <vaclav.ovsik@gmail.com>
Subject: [PATCH] fixes/gnu-inline

This patch adds `__attribute__ ((gnu_inline))' into prototype macros
before `inline' to force GNU89 behaviour of inline functions
in C99 mode.
See http://www.gnu.org/software/gcc/gcc-5/porting_to.html

Signed-off-by: Václav Ovsík <vaclav.ovsik@gmail.com>

---
 ustr-b-dbg-code.c       | 8 ++++----
 ustr-b-opt-code.c       | 8 ++++----
 ustr-cmp-dbg-code.c     | 8 ++++----
 ustr-cmp-opt-code.c     | 8 ++++----
 ustr-compiler.h         | 4 ++--
 ustr-fmt-dbg-code.c     | 8 ++++----
 ustr-fmt-opt-code.c     | 8 ++++----
 ustr-ins-dbg-code.c     | 8 ++++----
 ustr-ins-opt-code.c     | 8 ++++----
 ustr-io-dbg-code.c      | 8 ++++----
 ustr-io-opt-code.c      | 8 ++++----
 ustr-main-dbg-code.c    | 2 +-
 ustr-main-opt-code.c    | 2 +-
 ustr-parse-dbg-code.c   | 8 ++++----
 ustr-parse-opt-code.c   | 8 ++++----
 ustr-pool-dbg-code.c    | 8 ++++----
 ustr-pool-opt-code.c    | 8 ++++----
 ustr-replace-dbg-code.c | 8 ++++----
 ustr-replace-opt-code.c | 8 ++++----
 ustr-sc-dbg-code.c      | 8 ++++----
 ustr-sc-opt-code.c      | 8 ++++----
 ustr-set-dbg-code.c     | 8 ++++----
 ustr-set-opt-code.c     | 8 ++++----
 ustr-split-dbg-code.c   | 8 ++++----
 ustr-split-opt-code.c   | 8 ++++----
 ustr-spn-dbg-code.c     | 8 ++++----
 ustr-spn-opt-code.c     | 8 ++++----
 ustr-srch-dbg-code.c    | 8 ++++----
 ustr-srch-opt-code.c    | 8 ++++----
 ustr-sub-dbg-code.c     | 8 ++++----
 ustr-sub-opt-code.c     | 8 ++++----
 ustr-utf8-dbg-code.c    | 8 ++++----
 ustr-utf8-opt-code.c    | 8 ++++----
 33 files changed, 124 insertions(+), 124 deletions(-)

diff --git a/ustr-b-dbg-code.c b/ustr-b-dbg-code.c
index 4a7fdac..60e383e 100644
--- a/ustr-b-dbg-code.c
+++ b/ustr-b-dbg-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf-debug.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #undef  USTR_CONF_INCLUDE_CODEONLY_HEADERS
 #define USTR_CONF_INCLUDE_CODEONLY_HEADERS 1
@@ -16,5 +16,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-b.h"
diff --git a/ustr-b-opt-code.c b/ustr-b-opt-code.c
index 45e9e87..4011898 100644
--- a/ustr-b-opt-code.c
+++ b/ustr-b-opt-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #undef  USTR_CONF_INCLUDE_CODEONLY_HEADERS
 #define USTR_CONF_INCLUDE_CODEONLY_HEADERS 1
@@ -16,5 +16,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-b.h"
diff --git a/ustr-cmp-dbg-code.c b/ustr-cmp-dbg-code.c
index 7b8af33..4c3adc2 100644
--- a/ustr-cmp-dbg-code.c
+++ b/ustr-cmp-dbg-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf-debug.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #undef  USTR_CONF_INCLUDE_CODEONLY_HEADERS
 #define USTR_CONF_INCLUDE_CODEONLY_HEADERS 1
@@ -16,5 +16,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-cmp.h"
diff --git a/ustr-cmp-opt-code.c b/ustr-cmp-opt-code.c
index 2076d1c..ff5d02c 100644
--- a/ustr-cmp-opt-code.c
+++ b/ustr-cmp-opt-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #undef  USTR_CONF_INCLUDE_CODEONLY_HEADERS
 #define USTR_CONF_INCLUDE_CODEONLY_HEADERS 1
@@ -16,5 +16,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-cmp.h"
diff --git a/ustr-compiler.h b/ustr-compiler.h
index 9e71276..38ae026 100644
--- a/ustr-compiler.h
+++ b/ustr-compiler.h
@@ -92,7 +92,7 @@
 #endif

 #if USTR_CONF_COMPILE_USE_INLINE
-#define USTR__INLINE inline
+#define USTR__INLINE  __attribute__ ((gnu_inline)) inline
 #else
 #define USTR__INLINE /* no inline */
 #endif
@@ -123,7 +123,7 @@
 # if USTR_CONF_INCLUDE_CODEONLY_HEADERS
 #  define USTR_CONF_II_PROTO static USTR__INLINE
 # else
-#  define USTR_CONF_II_PROTO extern inline
+#  define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 # endif
 #endif

diff --git a/ustr-fmt-dbg-code.c b/ustr-fmt-dbg-code.c
index 4249bb1..1f147a0 100644
--- a/ustr-fmt-dbg-code.c
+++ b/ustr-fmt-dbg-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf-debug.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #undef  USTR_CONF_INCLUDE_CODEONLY_HEADERS
 #define USTR_CONF_INCLUDE_CODEONLY_HEADERS 1
@@ -16,5 +16,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-fmt.h"
diff --git a/ustr-fmt-opt-code.c b/ustr-fmt-opt-code.c
index c73e375..989b29f 100644
--- a/ustr-fmt-opt-code.c
+++ b/ustr-fmt-opt-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #undef  USTR_CONF_INCLUDE_CODEONLY_HEADERS
 #define USTR_CONF_INCLUDE_CODEONLY_HEADERS 1
@@ -16,5 +16,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-fmt.h"
diff --git a/ustr-ins-dbg-code.c b/ustr-ins-dbg-code.c
index 39f9bba..4c6d5ea 100644
--- a/ustr-ins-dbg-code.c
+++ b/ustr-ins-dbg-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf-debug.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #include "ustr-fmt.h"
 #undef  USTR_CONF_INCLUDE_CODEONLY_HEADERS
@@ -17,5 +17,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-ins.h"
diff --git a/ustr-ins-opt-code.c b/ustr-ins-opt-code.c
index 1aca827..859b44d 100644
--- a/ustr-ins-opt-code.c
+++ b/ustr-ins-opt-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #include "ustr-fmt.h"
 #undef  USTR_CONF_INCLUDE_CODEONLY_HEADERS
@@ -17,5 +17,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-ins.h"
diff --git a/ustr-io-dbg-code.c b/ustr-io-dbg-code.c
index c361c93..d42e43f 100644
--- a/ustr-io-dbg-code.c
+++ b/ustr-io-dbg-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf-debug.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #undef  USTR_CONF_INCLUDE_CODEONLY_HEADERS
 #define USTR_CONF_INCLUDE_CODEONLY_HEADERS 1
@@ -16,5 +16,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-io.h"
diff --git a/ustr-io-opt-code.c b/ustr-io-opt-code.c
index b1b4525..ae8de87 100644
--- a/ustr-io-opt-code.c
+++ b/ustr-io-opt-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #undef  USTR_CONF_INCLUDE_CODEONLY_HEADERS
 #define USTR_CONF_INCLUDE_CODEONLY_HEADERS 1
@@ -16,5 +16,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-io.h"
diff --git a/ustr-main-dbg-code.c b/ustr-main-dbg-code.c
index 4b821ce..abaa53a 100644
--- a/ustr-main-dbg-code.c
+++ b/ustr-main-dbg-code.c
@@ -7,5 +7,5 @@
 #define USTR_CONF_E_PROTO  extern
 #define USTR_CONF_I_PROTO
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
diff --git a/ustr-main-opt-code.c b/ustr-main-opt-code.c
index 233fb60..7ef6e98 100644
--- a/ustr-main-opt-code.c
+++ b/ustr-main-opt-code.c
@@ -7,5 +7,5 @@
 #define USTR_CONF_E_PROTO  extern
 #define USTR_CONF_I_PROTO
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
diff --git a/ustr-parse-dbg-code.c b/ustr-parse-dbg-code.c
index c9653af..6e1707d 100644
--- a/ustr-parse-dbg-code.c
+++ b/ustr-parse-dbg-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf-debug.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #undef  USTR_CONF_INCLUDE_CODEONLY_HEADERS
 #define USTR_CONF_INCLUDE_CODEONLY_HEADERS 1
@@ -16,5 +16,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-parse.h"
diff --git a/ustr-parse-opt-code.c b/ustr-parse-opt-code.c
index 0c8df4d..fc96db2 100644
--- a/ustr-parse-opt-code.c
+++ b/ustr-parse-opt-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #undef  USTR_CONF_INCLUDE_CODEONLY_HEADERS
 #define USTR_CONF_INCLUDE_CODEONLY_HEADERS 1
@@ -16,5 +16,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-parse.h"
diff --git a/ustr-pool-dbg-code.c b/ustr-pool-dbg-code.c
index adf7519..957f9ca 100644
--- a/ustr-pool-dbg-code.c
+++ b/ustr-pool-dbg-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf-debug.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #undef  USTR_CONF_INCLUDE_CODEONLY_HEADERS
 #define USTR_CONF_INCLUDE_CODEONLY_HEADERS 1
@@ -16,5 +16,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-pool.h"
diff --git a/ustr-pool-opt-code.c b/ustr-pool-opt-code.c
index 2b0367c..c1b2413 100644
--- a/ustr-pool-opt-code.c
+++ b/ustr-pool-opt-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #undef  USTR_CONF_INCLUDE_CODEONLY_HEADERS
 #define USTR_CONF_INCLUDE_CODEONLY_HEADERS 1
@@ -16,5 +16,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-pool.h"
diff --git a/ustr-replace-dbg-code.c b/ustr-replace-dbg-code.c
index fe02187..90531ac 100644
--- a/ustr-replace-dbg-code.c
+++ b/ustr-replace-dbg-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf-debug.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #include "ustr-set.h"
 #include "ustr-srch.h"
@@ -19,5 +19,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-replace.h"
diff --git a/ustr-replace-opt-code.c b/ustr-replace-opt-code.c
index e76b3bb..6232753 100644
--- a/ustr-replace-opt-code.c
+++ b/ustr-replace-opt-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #include "ustr-set.h"
 #include "ustr-srch.h"
@@ -19,5 +19,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-replace.h"
diff --git a/ustr-sc-dbg-code.c b/ustr-sc-dbg-code.c
index 0011c63..d7ce317 100644
--- a/ustr-sc-dbg-code.c
+++ b/ustr-sc-dbg-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf-debug.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #include "ustr-spn.h"
 #include "ustr-utf8.h"
@@ -18,5 +18,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-sc.h"
diff --git a/ustr-sc-opt-code.c b/ustr-sc-opt-code.c
index 7cb81ba..4a97ed9 100644
--- a/ustr-sc-opt-code.c
+++ b/ustr-sc-opt-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #include "ustr-spn.h"
 #include "ustr-utf8.h"
@@ -18,5 +18,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-sc.h"
diff --git a/ustr-set-dbg-code.c b/ustr-set-dbg-code.c
index 023875a..cf77071 100644
--- a/ustr-set-dbg-code.c
+++ b/ustr-set-dbg-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf-debug.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #include "ustr-fmt.h"
 #undef  USTR_CONF_INCLUDE_CODEONLY_HEADERS
@@ -17,5 +17,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-set.h"
diff --git a/ustr-set-opt-code.c b/ustr-set-opt-code.c
index e726888..34dcaf6 100644
--- a/ustr-set-opt-code.c
+++ b/ustr-set-opt-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #include "ustr-fmt.h"
 #undef  USTR_CONF_INCLUDE_CODEONLY_HEADERS
@@ -17,5 +17,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-set.h"
diff --git a/ustr-split-dbg-code.c b/ustr-split-dbg-code.c
index 03e5ca5..e40d2a5 100644
--- a/ustr-split-dbg-code.c
+++ b/ustr-split-dbg-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf-debug.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #include "ustr-set.h"
 #include "ustr-spn.h"
@@ -19,5 +19,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-split.h"
diff --git a/ustr-split-opt-code.c b/ustr-split-opt-code.c
index d64e300..74f4b1c 100644
--- a/ustr-split-opt-code.c
+++ b/ustr-split-opt-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #include "ustr-set.h"
 #include "ustr-spn.h"
@@ -19,5 +19,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-split.h"
diff --git a/ustr-spn-dbg-code.c b/ustr-spn-dbg-code.c
index ff97432..b0b09d4 100644
--- a/ustr-spn-dbg-code.c
+++ b/ustr-spn-dbg-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf-debug.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #include "ustr-srch.h"
 #include "ustr-utf8.h"
@@ -18,5 +18,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-spn.h"
diff --git a/ustr-spn-opt-code.c b/ustr-spn-opt-code.c
index 3ff0a07..92c5ccc 100644
--- a/ustr-spn-opt-code.c
+++ b/ustr-spn-opt-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #include "ustr-srch.h"
 #include "ustr-utf8.h"
@@ -18,5 +18,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-spn.h"
diff --git a/ustr-srch-dbg-code.c b/ustr-srch-dbg-code.c
index 40e4dbf..0f4da21 100644
--- a/ustr-srch-dbg-code.c
+++ b/ustr-srch-dbg-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf-debug.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #include "ustr-cmp-internal.h"
 #undef  USTR_CONF_INCLUDE_CODEONLY_HEADERS
@@ -17,6 +17,6 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-srch.h"

diff --git a/ustr-srch-opt-code.c b/ustr-srch-opt-code.c
index 635464d..8dde13d 100644
--- a/ustr-srch-opt-code.c
+++ b/ustr-srch-opt-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #include "ustr-cmp-internal.h"
 #undef  USTR_CONF_INCLUDE_CODEONLY_HEADERS
@@ -17,6 +17,6 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-srch.h"

diff --git a/ustr-sub-dbg-code.c b/ustr-sub-dbg-code.c
index f994716..b1712e6 100644
--- a/ustr-sub-dbg-code.c
+++ b/ustr-sub-dbg-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf-debug.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #include "ustr-fmt.h"
 #include "ustr-ins.h"
@@ -19,5 +19,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-sub.h"
diff --git a/ustr-sub-opt-code.c b/ustr-sub-opt-code.c
index 8cdb4eb..91780c7 100644
--- a/ustr-sub-opt-code.c
+++ b/ustr-sub-opt-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #include "ustr-fmt.h"
 #include "ustr-ins.h"
@@ -19,5 +19,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-sub.h"
diff --git a/ustr-utf8-dbg-code.c b/ustr-utf8-dbg-code.c
index 2666fc2..30786e9 100644
--- a/ustr-utf8-dbg-code.c
+++ b/ustr-utf8-dbg-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf-debug.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #undef  USTR_CONF_INCLUDE_CODEONLY_HEADERS
 #define USTR_CONF_INCLUDE_CODEONLY_HEADERS 1
@@ -16,5 +16,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-utf8.h"
diff --git a/ustr-utf8-opt-code.c b/ustr-utf8-opt-code.c
index 91fa754..abdf4c0 100644
--- a/ustr-utf8-opt-code.c
+++ b/ustr-utf8-opt-code.c
@@ -3,11 +3,11 @@
 #include "ustr-conf.h"
 #define USTR_CONF_USE_DYNAMIC_CONF USTR_CONF_HAVE_DYNAMIC_CONF
 #define USTR_CONF_e_PROTO  extern
-#define USTR_CONF_i_PROTO  extern inline
+#define USTR_CONF_i_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_E_PROTO  extern
-#define USTR_CONF_I_PROTO  extern inline
+#define USTR_CONF_I_PROTO  extern  __attribute__ ((gnu_inline)) inline
 #define USTR_CONF_EI_PROTO extern
-#define USTR_CONF_II_PROTO extern inline
+#define USTR_CONF_II_PROTO extern  __attribute__ ((gnu_inline)) inline
 #include "ustr-main.h"
 #undef  USTR_CONF_INCLUDE_CODEONLY_HEADERS
 #define USTR_CONF_INCLUDE_CODEONLY_HEADERS 1
@@ -16,5 +16,5 @@
 #undef  USTR_CONF_I_PROTO
 #define USTR_CONF_I_PROTO
 #undef  USTR_CONF_II_PROTO
-#define USTR_CONF_II_PROTO inline
+#define USTR_CONF_II_PROTO  __attribute__ ((gnu_inline)) inline
 #include "ustr-utf8.h"
--
tg: (b148fb7..) fixes/gnu-inline (depends on: upstream)


code:
This test checks whether 'root' is successfully translated to UID/GID 0,
using 'getpwnam' in libmount.  This doesn't work in the chroot because
/etc/passwd doesn't contain an entry for 'root' so skip it.

The second test requires that '/sys/dev/block' is present, which is not
the case inside the build container.

--- util-linux-2.25.2/tests/ts/libmount/optstr	2015-01-23 13:58:41.181151194 +0100
+++ util-linux-2.25.2/tests/ts/libmount/optstr	2015-01-23 13:58:42.829161716 +0100
@@ -108,10 +108,6 @@
 ts_run $TESTPROG --apply --user "noexec,nosuid,loop=/dev/looop0" 0x408 &> $TS_OUTPUT
 ts_finalize_subtest

-ts_init_subtest "fix"
-ts_run $TESTPROG --fix "uid=root,gid=root" &> $TS_OUTPUT
-ts_finalize_subtest
-
 ts_init_subtest "deduplicate"
 ts_run $TESTPROG --dedup bbb,ccc,AAA,xxx,AAA=a,AAA=bbb,ddd,AAA=ccc,fff=eee AAA &> $TS_OUTPUT
 ts_finalize_subtest
--- a/tests/ts/lsblk/lsblk	2019-03-11 21:08:23.734387391 +0100
+++ b/tests/ts/lsblk/lsblk	2019-03-11 21:12:43.635473111 +0100
@@ -22,6 +22,8 @@

 ts_init "$*"

+ts_skip "/sys/dev/block is not available"
+
 ts_check_test_command "$TS_CMD_LSBLK"
 ts_check_prog xz
 ts_check_prog tar


code:
Accept "arm" instead of "armv7" in configure, see
   http://valgrind.10908.n7.nabble.com/building-for-arm-td39382.html .

diff -u -r valgrind-3.11.0.orig/configure valgrind-3.11.0/configure
--- valgrind-3.11.0.orig/configure	2015-10-02 20:37:41.915721386 +0200
+++ valgrind-3.11.0/configure	2015-10-02 20:37:54.886746395 +0200
@@ -5607,7 +5607,7 @@
         ARCH_MAX="s390x"
         ;;

-     armv7*)
+     arm*)
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (${host_cpu})" >&5
 $as_echo "ok (${host_cpu})" >&6; }
 	ARCH_MAX="arm"


code:
This patch was copied from Debian.

Description: Fix format load_address for 32 bits architectures
 The offset and load_address are 64bits integers
 On 32bits we have to use strtoull (instead of strtoul) to parse number
 into 64bits unsigned integers. Without this the parsed numbers are
 truncated to 2^32-1.
Author: Sophie Brun <sophie@freexian.com>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=881997
Forwarded: https://bugs.chromium.org/p/chromium/issues/detail?id=786969
Last-Update: 2017-11-20
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/futility/cmd_bdb.c
+++ b/futility/cmd_bdb.c
@@ -637,7 +637,7 @@ static int do_bdb(int argc, char *argv[]
 			}
 			break;
 		case OPT_OFFSET:
-			offset = strtoul(optarg, &e, 0);
+			offset = strtoull(optarg, &e, 0);
 			if (!*optarg || (e && *e)) {
 				fprintf(stderr, "Invalid --offset\n");
 				parse_error = 1;
@@ -658,7 +658,7 @@ static int do_bdb(int argc, char *argv[]
 			}
 			break;
 		case OPT_LOAD_ADDRESS:
-			load_address = strtoul(optarg, &e, 0);
+			load_address = strtoull(optarg, &e, 0);
 			if (!*optarg || (e && *e)) {
 				fprintf(stderr, "Invalid --load_address\n");
 				parse_error = 1;