Regarding bug report  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=804494

First of all, it seems that the version in git (
git://git.debian.org/git/collab-maint/ltrace.git) is way different
than the release version. ltrace-0.7.3 So in git the strings are not
printed at all, the git version is also segfaulting. I have installed
the source code from the package with apt-src and found the offending
line in format array. It gets the min length specifier of the element
and treats it as the max length. Really we want the string length to
be len. I dont know yet how this all works. I am starting to think to
look how the lengths are collected not how they are used. Will look
into that next.

(gdb) l
339 */
340 int
341 format_array(FILE *stream, struct value *value, struct value_dict
*arguments,
342     struct expr_node *length, size_t maxlen, int before,
343     const char *open, const char *close, const char *delim)
344 {
345 /* We need "long" to be long enough to cover the whole address
346 * space.  */
347 (void)sizeof(char[1 - 2*(sizeof(long) < sizeof(void *))]);
348 long l;
(gdb) l
349 if (expr_eval_word(length, value, arguments, &l) < 0)
350 return -1;
351 size_t len = (size_t)l;
352
353 int written = 0;
354 if (acc_fprintf(&written, stream, "%s", open) < 0)
355 return -1;
356
357 size_t i;
358 for (i = 0; i < len && i <= maxlen; ++i) {
(gdb) b 351
Breakpoint 33 at 0x40d18a: file lens_default.c, line 351.
(gdb) c
Continuing.

Breakpoint 33, format_array (stream=stream@entry=0x690210,
    value=value@entry=0x7fffffffdd60, arguments=arguments@entry=0x641a00,
    length=<optimized out>, maxlen=32, before=before@entry=0,
    open=0x42c96c "\"", close=0x42c96c "\"", delim=0x42e3bd "")
    at lens_default.c:351
351 size_t len = (size_t)l;
(gdb) p l
$135 = 8

This 8 should be the length of the string, not the min value.
from :
  fprintf(fp, "%-4s: %-8s ", "body", "undefined");

-- 
James Michael DuPont
Kansas Linux Fest http://kansaslinuxfest.us
Free/Libre Open Source and Open Knowledge Association of Kansas
http://openkansas.us
Member of Free Libre Open Source Software Kosova http://www.flossk.org
Saving Wikipedia(tm) articles from deletion http://SpeedyDeletion.wikia.com

Reply via email to