components/autogen/patches/autoopts-numeric.c.patch
author John Beck <John.Beck@Oracle.COM>
Fri, 09 Sep 2016 13:08:45 -0700
changeset 6889 83e26eb7e42b
parent 1636 d3ad0c91bf12
permissions -rw-r--r--
24624202 virtualenv needs bypass on S11

Prevent "/usr/bin/columns --help" from crashing.

This problem has been reported upstream and fixed in a future autogen
release. The autogen maintainer says:

"This is a very long standing bug that I'm surprised hasn't surfaced before:

In autoopts/numeric.c we have:

    /*
     *  Numeric options may have a range associated with it.
     *  If it does, the usage procedure requests that it be
     *  emitted by passing a NULL od pointer.  Also bail out
     *  if there is no option argument or if we are being reset.
     */
    if (  (od == NULL)
       || (od->optArg.argString == NULL)
       || ((od->fOptState & OPTST_RESET) != 0))
        return;

    errno = 0;
    val = strtol(od->optArg.argString, &pz, 0);

Another condition for that bail-out needs to be whether or not
the "argString" has just been set.  It has not been in this case
because we are trying to tease out some usage information."

This patch is based on the solution provided by the autogen maintainer.

--- autogen-5.16.2/autoopts/numeric.c.orig	2014-01-09 12:50:03.575210189 -0800
+++ autogen-5.16.2/autoopts/numeric.c	2014-01-09 13:08:29.709753147 -0800
@@ -111,7 +111,8 @@
      */
     if (  (pOD == NULL)
        || (pOD->optArg.argString == NULL)
-       || ((pOD->fOptState & OPTST_RESET) != 0))
+       || ((pOD->fOptState & OPTST_RESET) != 0)
+       || (pOpts <= OPTPROC_EMIT_LIMIT))
         return;
 
     errno = 0;