File: chasen-initialize-memory.patch

package info (click to toggle)
chasen 2.4.5-46.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,616 kB
  • sloc: sh: 10,024; ansic: 5,983; cpp: 179; makefile: 111; perl: 10
file content (30 lines) | stat: -rw-r--r-- 969 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Author: Bernhard M. Wiedemann <bwiedemann suse de>
Date: 2017-11-08

Problem: when building the ipadic package it differed for every build
because its chadic.dat contains uninitialized memory
from the da_dat_t structure's padding bytes

Solution: initialize memory (including padding added by compilers)
before use

Index: chasen-2.4.4/mkchadic/dumpdic.c
===================================================================
--- chasen-2.4.4.orig/mkchadic/dumpdic.c
+++ chasen-2.4.4/mkchadic/dumpdic.c
@@ -45,6 +45,7 @@ dump_dat(lexicon_t *lex, FILE *datfile,
     long index;
     da_dat_t dat;
 
+    memset(&dat, 0, sizeof(dat));
     index = ftell(datfile);
     dat.stem_len = lex->stem_len;
     dat.reading_len = lex->reading_len;
@@ -137,6 +138,7 @@ dump_dic(lexicon_t *entries, FILE *outpu
     da_lex_t lex;
     long compound = NO_COMPOUND;
 
+    memset(&lex, 0, sizeof(lex));
     if (entries[1].pos)
 	compound = dump_compound(entries, lexfile, datfile);