Source: libminini
Version: 1.2.a+ds-2
Severity: normal

Dear Maintainer,

The build fails in test1 with a segmentation fault:

LD_LIBRARY_PATH=. ./test1
Segmentation fault

This is caused by the fact that objects linked into shared libraries need
to be compiled with the -fPIC option.  This option also needs to be added
when linking shared libraries.  With this problem fixed, test1 now runs
correctly but test2 fails at the following assert:

LD_LIBRARY_PATH=. ./test2
test2: minIni.cc:214: char* save_strncpy(char*, const char*, size_t, 
quote_option): Assertion `dest <= source || dest >= source + maxlen' failed.
Aborted

Breakpoint 1, save_strncpy (dest=0xf8f02808 "\370\360\"\300",
    source=0xf8f02630 "aap", maxlen=512, option=QUOTE_NONE) at minIni.cc:214
214       assert(dest <= source || dest >= source + maxlen);
(gdb) p dest <= source
$4 = false
(gdb) p dest
$5 = 0xf8f02808 "\370\360\"\300"
(gdb) p source
$6 = 0xf8f02630 "aap"
(gdb) p dest >= source + maxlen
$7 = false
(gdb) p maxlen
$8 = 512
(gdb) p/x $sp
$9 = 0xf8f02b40

It looks like the assert is triggered on hppa because the stack grows up.

Package builds if I disable assert:

dave@atlas:~/debian/libminini/libminini-1.2.a+ds$ diff -u minIni.cc.save 
minIni.cc
--- minIni.cc.save      2019-07-20 16:46:47.744616954 -0400
+++ minIni.cc   2019-07-20 16:47:31.594198802 -0400
@@ -211,7 +211,9 @@
   size_t d, s;

   assert(maxlen>0);
+#ifndef __hppa__
   assert(dest <= source || dest >= source + maxlen);
+#endif
   if (option == QUOTE_ENQUOTE && maxlen < 3)
     option = QUOTE_NONE;  /* cannot store two quotes and a terminating zero in 
less than 3 characters */

Regards,
Dave Anglin


-- System Information:
Debian Release: bullseye/sid
  APT prefers buildd-unstable
  APT policy: (500, 'buildd-unstable'), (500, 'unstable')
Architecture: hppa (parisc64)

Kernel: Linux 4.14.133+ (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Reply via email to