Control: tags -1 + patch

I attached a patch that initializes the parsed tables with 0,
before they are assigned to sflaglist.
diff --git a/debian/patches/0031-Initialize-table.patch b/debian/patches/0031-Initialize-table.patch
new file mode 100644
index 0000000..43f6c11
--- /dev/null
+++ b/debian/patches/0031-Initialize-table.patch
@@ -0,0 +1,51 @@
+Author: Reiner Herrmann <[email protected]>
+Description: initialize table with zero to prevent uninitialized memory being written
+Bug-Debian: https://bugs.debian.org/778862
+
+Index: ispell-3.3.02/parse.y
+===================================================================
+--- ispell-3.3.02.orig/parse.y
++++ ispell-3.3.02/parse.y
+@@ -205,6 +205,7 @@ static int		nbasestrings = 0; /* Number
+ static struct flagent * table;		/* Current table being built */
+ static int		tblnum;		/* Numer of entries in table */
+ static int		tblsize = 0;	/* Size of the flag table */
++static int		tmp = 0;
+ static int		ungrablen;	/* Size of ungrab area */
+ %}
+ 
+@@ -898,7 +899,7 @@ table		:	flagdef
+ 				tblsize = centnum + TBLINC;
+ 				tblnum = 0;
+ 				table = (struct flagent *)
+-				  malloc (tblsize * (sizeof (struct flagent)));
++				  calloc (tblsize, sizeof (struct flagent));
+ 				if (table == NULL)
+ 				    {
+ 				    yyerror (PARSE_Y_NO_SPACE);
+@@ -907,6 +908,7 @@ table		:	flagdef
+ 				}
+ 			    else if (tblnum + centnum >= tblsize)
+ 				{
++				tmp = tblsize;
+ 				tblsize = tblnum + centnum + TBLINC;
+ 				table = (struct flagent *)
+ 				  realloc ((char *) table,
+@@ -916,6 +918,8 @@ table		:	flagdef
+ 				    yyerror (PARSE_Y_NO_SPACE);
+ 				    exit (1);
+ 				    }
++				memset(table + tmp * sizeof(struct flagent), 0,
++					tblsize * sizeof(struct flagent) - tmp * sizeof(struct flagent));
+ 				}
+ 			    for (tblnum = 0;  tblnum < centnum;  tblnum++)
+ 				table[tblnum] = curents[tblnum];
+@@ -936,6 +940,8 @@ table		:	flagdef
+ 				    yyerror (PARSE_Y_NO_SPACE);
+ 				    exit (1);
+ 				    }
++				memset(table + tmp * sizeof(struct flagent), 0,
++					tblsize * sizeof(struct flagent) - tmp * sizeof(struct flagent));
+ 				}
+ 			    for (i = 0;  i < centnum;  i++)
+ 				table[tblnum + i] = curents[i];
diff --git a/debian/patches/series b/debian/patches/series
index 06ebc04..a4f35d0 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -24,3 +24,4 @@
 0028-Fix-hardening-warnings.patch
 0029-Generate-hex-in-fix8bit.patch
 0030-Display-whole-multibyte-character.patch
+0031-Initialize-table.patch

Attachment: signature.asc
Description: OpenPGP digital signature



Reply via email to