pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/x11/motif x11/motif: Patch ctype(3) abuse.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/e2411896c896
branches:  trunk
changeset: 376313:e2411896c896
user:      riastradh <riastradh%pkgsrc.org@localhost>
date:      Tue Apr 05 09:59:56 2022 +0000

description:
x11/motif: Patch ctype(3) abuse.

diffstat:

 x11/motif/distinfo                          |  10 +++-
 x11/motif/patches/patch-lib_Xm_ColorS.c     |  58 +++++++++++++++++++++++
 x11/motif/patches/patch-lib_Xm_DataF.c      |  15 ++++++
 x11/motif/patches/patch-lib_Xm_Picture.c    |  72 +++++++++++++++++++++++++++++
 x11/motif/patches/patch-lib_Xm_RepType.c    |  28 +++++++++++
 x11/motif/patches/patch-lib_Xm_ResConvert.c |  24 +++++++++
 x11/motif/patches/patch-lib_Xm_XmRenderT.c  |  30 ++++++++++++
 x11/motif/patches/patch-lib_Xm_Xpmparse.c   |  15 ++++++
 x11/motif/patches/patch-lib_Xm_Xpmrgb.c     |  24 +++++++++
 9 files changed, 275 insertions(+), 1 deletions(-)

diffs (truncated from 325 to 300 lines):

diff -r a5c3c38b7aa9 -r e2411896c896 x11/motif/distinfo
--- a/x11/motif/distinfo        Tue Apr 05 09:25:02 2022 +0000
+++ b/x11/motif/distinfo        Tue Apr 05 09:59:56 2022 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.10 2021/10/26 11:34:15 nia Exp $
+$NetBSD: distinfo,v 1.11 2022/04/05 09:59:56 riastradh Exp $
 
 BLAKE2s (motif-2.3.8.tar.gz) = b82ee8dac7a840aaa0f364e5b5c018d053a1eb42433e52e5b54f7742d34cbb23
 SHA512 (motif-2.3.8.tar.gz) = 1ab8e8eece25ef97e948592b5fa3e19d98e932695290a18b7a8e90f1aa2766bc4f082bdbc3999dff5660e684821178a149040f76bb477163e53ca06474d02b55
@@ -10,9 +10,17 @@
 SHA1 (patch-doc_man_man3_Makefile.am) = b396f5e1235834f507a415c62b0efaa939943f1d
 SHA1 (patch-doc_man_man4_Makefile.am) = 154071494cf54a65e2e266861c81771a14156cae
 SHA1 (patch-doc_man_man5_Makefile.am) = 2f6e0cc239faf53e3391aef9da3def934023928e
+SHA1 (patch-lib_Xm_ColorS.c) = 62b25d550b76c01391e14b7ed9a19888e4ecec06
+SHA1 (patch-lib_Xm_DataF.c) = 1d0f55e0aef0621507af7c00eef1f3aeef7c0a4b
+SHA1 (patch-lib_Xm_Picture.c) = 2e47eff79c09cd0fc344da1d7c117591533d2ef5
+SHA1 (patch-lib_Xm_RepType.c) = 039b4ab7b0cee1c0de73794519c813b6e472fa0c
+SHA1 (patch-lib_Xm_ResConvert.c) = 24d527bcdc10cba749c1d1186d166214974d43e3
 SHA1 (patch-lib_Xm_Scale.c) = d78669a3332ab9d7dd140a1a1d9532e065573c7b
 SHA1 (patch-lib_Xm_TextF.c) = 1bd1801d708ff2c832c131c9954b3bbfd444ed42
+SHA1 (patch-lib_Xm_XmRenderT.c) = 674a0baae060fa32670cf38bd37323a206dd3f59
 SHA1 (patch-lib_Xm_Xmfuncs.h) = fef6a642988a8024da0bff00cdc40dc485695e2b
 SHA1 (patch-lib_Xm_Xmos.c) = 88af3627fad7c9ec40db0e8aca47e9617fe8c53b
 SHA1 (patch-lib_Xm_XpmI.h) = b27e0156bc2dd990a4d9642186b1638276054314
+SHA1 (patch-lib_Xm_Xpmparse.c) = 95eb0d2d59fcd8c3dd4c9622e17568b35ffbe133
+SHA1 (patch-lib_Xm_Xpmrgb.c) = 494506830c6e96bffe691b511ebe52dd0a1ac2ab
 SHA1 (patch-tools_wml_wmluiltok.l) = 1e79df5605ad8b25a55fbb617a707d27d27e3f2a
diff -r a5c3c38b7aa9 -r e2411896c896 x11/motif/patches/patch-lib_Xm_ColorS.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/x11/motif/patches/patch-lib_Xm_ColorS.c   Tue Apr 05 09:59:56 2022 +0000
@@ -0,0 +1,58 @@
+$NetBSD: patch-lib_Xm_ColorS.c,v 1.1 2022/04/05 09:59:56 riastradh Exp $
+
+Fix ctype(3) abuse.
+
+--- lib/Xm/ColorS.c.orig       2016-03-16 02:10:08.000000000 +0000
++++ lib/Xm/ColorS.c
+@@ -846,7 +846,7 @@ EndsInDigits(char *str)
+     register char *c = str;
+     while(*c != '\0') c++;    /* advance to end of string marker */
+     c--;                      /* back to the last character */
+-    if(c >= str && isascii(*c) && isdigit(*c)) 
++    if(c >= str && isascii((unsigned char)*c) && isdigit((unsigned char)*c)) 
+       return True;
+     
+     return False;
+@@ -1307,15 +1307,15 @@ read_rgb_file(XmColorSelectorWidget csw,
+               /*
+                * Copy in all characters that are ascii and non-spaces.
+                */
+-              if (!isascii(c))
++              if (!isascii((unsigned char)c))
+                   continue;
+-              if (!isspace(c))
+-                  *name++ = tolower(c);
++              if (!isspace((unsigned char)c))
++                  *name++ = tolower((unsigned char)c);
+           }
+           *name = '\0';
+ 
+           name = color_info[count].name;
+-          color_name[0] = toupper(color_name[0]);
++          color_name[0] = toupper((unsigned char)color_name[0]);
+           for (i = 0; i < len; i++) {
+               register char c = color_name[i];
+ 
+@@ -1323,10 +1323,10 @@ read_rgb_file(XmColorSelectorWidget csw,
+                * Capitalize all characters after a space.
+                */
+ 
+-              if (!isascii(c))
++              if (!isascii((unsigned char)c))
+                   continue;
+-              if (isspace(c) && ((i + 1) < len)) {
+-                  color_name[i + 1] = toupper(color_name[i + 1]);
++              if (isspace((unsigned char)c) && ((i + 1) < len)) {
++                  color_name[i + 1] = toupper((unsigned char)color_name[i + 1]);
+               }
+ 
+               *name++ = c;
+@@ -1452,7 +1452,7 @@ find_name(char *buffer)
+        * Look for first non number, non space or tab.
+        */
+     
+-      if (isascii(*curr) && (isdigit(*curr) || isspace(*curr)))
++      if (isascii((unsigned char)*curr) && (isdigit((unsigned char)*curr) || isspace((unsigned char)*curr)))
+           continue;
+ 
+       temp = (char *) strchr(curr, '\n');
diff -r a5c3c38b7aa9 -r e2411896c896 x11/motif/patches/patch-lib_Xm_DataF.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/x11/motif/patches/patch-lib_Xm_DataF.c    Tue Apr 05 09:59:56 2022 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-lib_Xm_DataF.c,v 1.1 2022/04/05 09:59:56 riastradh Exp $
+
+Fix out-of-bounds array access from off-by-one in backwards iteration.
+
+--- lib/Xm/DataF.c.orig        2017-10-30 20:20:09.000000000 +0000
++++ lib/Xm/DataF.c
+@@ -4577,7 +4577,7 @@ _XmDataFieldIsWSpace(
+ {
+    int i;
+ 
+-   for (i=num_entries; i > 0; i--){
++   for (i=num_entries; i --> 0;){
+       if (wide_char == white_space[i]) return True;
+    }
+    return False;
diff -r a5c3c38b7aa9 -r e2411896c896 x11/motif/patches/patch-lib_Xm_Picture.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/x11/motif/patches/patch-lib_Xm_Picture.c  Tue Apr 05 09:59:56 2022 +0000
@@ -0,0 +1,72 @@
+$NetBSD: patch-lib_Xm_Picture.c,v 1.1 2022/04/05 09:59:56 riastradh Exp $
+
+Fix ctype(3) abuse.
+
+--- lib/Xm/Picture.c.orig      2016-03-16 02:14:09.000000000 +0000
++++ lib/Xm/Picture.c
+@@ -245,15 +245,15 @@ XmPictureDoAutoFill(XmPictureState state
+ 
+       if(fill.c == '\0')
+           fill.reject = True;
+-      if(fill.digit && (isdigit(fill.c) == 0))
++      if(fill.digit && (isdigit((unsigned char)fill.c) == 0))
+           fill.reject = True;
+-      if(fill.hexdigit && (isxdigit(fill.c) == 0))
++      if(fill.hexdigit && (isxdigit((unsigned char)fill.c) == 0))
+           fill.reject = True;
+       if(fill.octaldigit && (fill.c < '0' || fill.c > '7'))
+           fill.reject = True;
+-      if(fill.letter && (isalpha(fill.c) == 0))
++      if(fill.letter && (isalpha((unsigned char)fill.c) == 0))
+           fill.reject = True;
+-      if(fill.upcase && islower(fill.c))
++      if(fill.upcase && islower((unsigned char)fill.c))
+           fill.reject = True;
+ 
+       if(fill.reject) return state->current_string;
+@@ -582,12 +582,12 @@ _XmPictureFollowTransitions(XmPictureSta
+               accepted = False;
+           break;
+       case NumericDigit:
+-          if(isdigit(inc)) {
++          if(isdigit((unsigned char)inc)) {
+               found = True;
+           }
+           break;
+       case HexDigit:
+-          if(isdigit(inc) ||
++          if(isdigit((unsigned char)inc) ||
+               (inc >= 'a' && inc <= 'f') ||
+               (inc >= 'A' && inc <= 'F')) {
+               found = True;
+@@ -599,24 +599,24 @@ _XmPictureFollowTransitions(XmPictureSta
+           }
+           break;
+       case AnyLetter:
+-          if(isalpha(inc)) {
++          if(isalpha((unsigned char)inc)) {
+               found = True;
+           }
+           break;
+       case UpCaseLetter:
+-          if(isalpha(inc)) {
+-              changed_c = toupper(inc);
++          if(isalpha((unsigned char)inc)) {
++              changed_c = toupper((unsigned char)inc);
+               found = True;
+           }
+           break;
+       case AnyCharacter:
+-          if(isalnum(inc)) {
++          if(isalnum((unsigned char)inc)) {
+               found = True;
+           }
+           break;
+       case UpCaseCharacter:
+-          if(isalnum(inc)) {
+-              changed_c = toupper(inc);
++          if(isalnum((unsigned char)inc)) {
++              changed_c = toupper((unsigned char)inc);
+               found = True;
+           }
+           break;
diff -r a5c3c38b7aa9 -r e2411896c896 x11/motif/patches/patch-lib_Xm_RepType.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/x11/motif/patches/patch-lib_Xm_RepType.c  Tue Apr 05 09:59:56 2022 +0000
@@ -0,0 +1,28 @@
+$NetBSD: patch-lib_Xm_RepType.c,v 1.1 2022/04/05 09:59:56 riastradh Exp $
+
+Fix ctype(3) abuse.
+
+--- lib/Xm/RepType.c.orig      2017-08-17 00:38:43.000000000 +0000
++++ lib/Xm/RepType.c
+@@ -1197,8 +1197,8 @@ CopyStringArray(
+               TmpStr[Index][1] = 'm' ;
+               i = 2 ;
+               while (TmpStr[Index][i]) {
+-                  if (islower(TmpStr[Index][i]))
+-                      TmpStr[Index][i] = toupper(TmpStr[Index][i]);
++                  if (islower((unsigned char)TmpStr[Index][i]))
++                      TmpStr[Index][i] = toupper((unsigned char)TmpStr[Index][i]);
+                   i++;
+               }
+               ++Index ;
+@@ -1762,8 +1762,8 @@ _XmConvertActionParamToRepTypeId(Widget 
+     if (can_be_numeric)
+     {
+       value = i = 0;
+-      while (isspace(parameter[i])) ++i; /* skip leading white space */
+-      if (isdigit(parameter[i]))
++      while (isspace((unsigned char)parameter[i])) ++i; /* skip leading white space */
++      if (isdigit((unsigned char)parameter[i]))
+       {
+           value = atoi(parameter + i);
+           /* If the number was converted, verify that it is a valid value
diff -r a5c3c38b7aa9 -r e2411896c896 x11/motif/patches/patch-lib_Xm_ResConvert.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/x11/motif/patches/patch-lib_Xm_ResConvert.c       Tue Apr 05 09:59:56 2022 +0000
@@ -0,0 +1,24 @@
+$NetBSD: patch-lib_Xm_ResConvert.c,v 1.1 2022/04/05 09:59:56 riastradh Exp $
+
+Fix ctype(3) abuse.
+
+--- lib/Xm/ResConvert.c.orig   2017-08-17 00:38:43.000000000 +0000
++++ lib/Xm/ResConvert.c
+@@ -1519,14 +1519,14 @@ CvtStringToCardinalList(
+                       (crd_array_size,sizeof(Cardinal));
+     while (*p != '\0')
+       {
+-      while ((isspace(*p) || ispunct(*p)) && *p != '\0') /* Skip blanks */
++      while ((isspace((unsigned char)*p) || ispunct((unsigned char)*p)) && *p != '\0') /* Skip blanks */
+           p++;
+       if (*p == '\0')                         /* end-of data */
+           break;
+-      if (isdigit(*p))
++      if (isdigit((unsigned char)*p))
+           {
+           new_element = atoi(p);              /* Grab number */
+-          while (isdigit(*p))         /* advance pointer past number */
++          while (isdigit((unsigned char)*p))          /* advance pointer past number */
+               p++;
+           if (crd_array_size == crd_array_count)
+               {
diff -r a5c3c38b7aa9 -r e2411896c896 x11/motif/patches/patch-lib_Xm_XmRenderT.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/x11/motif/patches/patch-lib_Xm_XmRenderT.c        Tue Apr 05 09:59:56 2022 +0000
@@ -0,0 +1,30 @@
+$NetBSD: patch-lib_Xm_XmRenderT.c,v 1.1 2022/04/05 09:59:56 riastradh Exp $
+
+Fix ctype(3) abuse.
+
+--- lib/Xm/XmRenderT.c.orig    2017-03-27 22:24:31.000000000 +0000
++++ lib/Xm/XmRenderT.c
+@@ -2788,7 +2788,7 @@ ReadToken(char *string, int *position)
+   int count;
+ 
+   /* Skip whitespace but not newlines */
+-  while (isspace(string[pos]) && ! (string[pos] == '\n'))
++  while (isspace((unsigned char)string[pos]) && ! (string[pos] == '\n'))
+     pos++;
+ 
+   /* Select token type */
+@@ -2828,12 +2828,12 @@ ReadToken(char *string, int *position)
+     }
+     break;
+   default:
+-    if (isalpha(string[pos])) /* String result */
++    if (isalpha((unsigned char)string[pos])) /* String result */
+       {
+       char temp[80];
+       int count;
+       for(count = 0; 
+-          isalpha(string[pos + count]) && count < 79;
++          isalpha((unsigned char)string[pos + count]) && count < 79;
+           count++) temp[count] = string[pos + count];
+       temp[count] = 0;
+       pos += count;
diff -r a5c3c38b7aa9 -r e2411896c896 x11/motif/patches/patch-lib_Xm_Xpmparse.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/x11/motif/patches/patch-lib_Xm_Xpmparse.c Tue Apr 05 09:59:56 2022 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-lib_Xm_Xpmparse.c,v 1.1 2022/04/05 09:59:56 riastradh Exp $
+
+Fix ctype(3) abuse.
+
+--- lib/Xm/Xpmparse.c.orig     2017-03-27 22:24:31.000000000 +0000
++++ lib/Xm/Xpmparse.c
+@@ -728,7 +728,7 @@ xpmParseExtensions(data, extensions, nex
+       ext += num;
+       /* skip whitespace and store its name */
+       s2 = s = string + 6;
+-      while (isspace(*s2))
++      while (isspace((unsigned char)*s2))
+           s2++;
+       a = s2 - s;
+       ext->name = (char *) XpmMalloc(l - a - 6);
diff -r a5c3c38b7aa9 -r e2411896c896 x11/motif/patches/patch-lib_Xm_Xpmrgb.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/x11/motif/patches/patch-lib_Xm_Xpmrgb.c   Tue Apr 05 09:59:56 2022 +0000



Home | Main Index | Thread Index | Old Index