[Libreoffice-commits] core.git: soltools/cpp

Stephan Bergmann sbergman at redhat.com
Mon Aug 21 12:04:37 UTC 2017


 soltools/cpp/cpp.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit dac11d8d504351644cf914b0f3f3689148b36e1b
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Aug 21 13:52:47 2017 +0200

    Make cpp cope with long source lines
    
    under --with-lang=ALL it had started to crash during e.g.
    
    > LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}".../instdir/program:.../instdir/program" .../workdir/LinkTarget/Executable/cpp -+ -P -DWITH_POSTGRESQL_SDBC -DWITH_FIREBIRD_SDBC -DWITHOUT_EXTENSION_MEDIAWIKI -DWITHOUT_SCRIPTING_BEANSHELL -DWITHOUT_SCRIPTING_JAVASCRIPT -DWITH_HELPPACK_INTEGRATION -DWITH_EXTENSION_INTEGRATION -DENABLE_EXTENSION_UPDATE -DX86_64 -DLINUX -D_PTHREADS -DUNIX -DUNX -DCOMID=gcc3 -D_gcc3 -DWITH_LPSOLVER -I.../scp2/inc -I.../workdir -I.../config_host -I.../workdir/CustomTarget/scp2/macros -I.../workdir/ScpTemplateTarget/scp2/source/templates .../scp2/source/calc/file_calc.scp > .../workdir/ScpPreprocessTarget/scp2/source/calc/file_calc.pre
    
    because of
    
    > Syscall param read(buf) points to unaddressable byte(s)
    >    at 0x4F31A80: __read_nocancel (syscall-template.S:84)
    >    by 0x404F98: fillbuf (_lex.c:631)
    >    by 0x404CCF: gettokens (_lex.c:479)
    >    by 0x400F0A: process (_cpp.c:77)
    >    by 0x400E80: main (_cpp.c:60)
    >  Address 0x5278494 is 0 bytes after a block of size 32,772 alloc'd
    >    at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
    >    by 0x402034: domalloc (_cpp.c:321)
    >    by 0x40554F: setsource (_lex.c:679)
    >    by 0x403E38: doinclude (_include.c:130)
    >    by 0x401F9D: control (_cpp.c:297)
    >    by 0x401002: process (_cpp.c:101)
    >    by 0x400E80: main (_cpp.c:60)
    
    There appears to be no other check that fillbuf doesn't overflow the Source's
    input buffer, other than gettokens checking that the buffer isn't more than
    three quarters full ("if (ip >= s->inb + (3 * INS / 4)) ...").  That smells like
    cpp assumes input lines to be shorter than some maximum number of characters
    (like the C99 standard setting a minimum limit of "4095 characters in logical
    source lines"), and
    
    > #define README_TXT_ALL_LANG(key, name, ext) \
    >       key (af) = READMETXTFILENAME(name,_af,ext); \
    >       Name (am) = CONFIGLANGFILENAME(name,am,ext); \
    >       Name (ar) = CONFIGLANGFILENAME(name,ar,ext); \
    [...]
    >       Name (zh-CN) = CONFIGLANGFILENAME(name,zh-CN,ext); \
    >       Name (zh-TW) = CONFIGLANGFILENAME(name,zh-TW,ext); \
    >       key (zu) = READMETXTFILENAME(name,_zu,ext)
    
    in workdir/CustomTarget/scp2/macros/langmacros.inc (which appears to be the
    culprit here) exceeding that limit under --with-lang=ALL.
    
    So just bump the input buffer size.
    
    Change-Id: I5d863050fb772dc7e691a604009ff8702dc718e3

diff --git a/soltools/cpp/cpp.h b/soltools/cpp/cpp.h
index e09ea7db86f2..36b867679d15 100644
--- a/soltools/cpp/cpp.h
+++ b/soltools/cpp/cpp.h
@@ -20,7 +20,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#define INS         32768   /* input buffer                             */
+#define INS         327680  /* input buffer                             */
 #define OBS         8092    /* output buffer                            */
 #define NARG        32      /* Max number arguments to a macro          */
 #define NINCLUDE    48      /* Max number of include directories (-I)   */


More information about the Libreoffice-commits mailing list