MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000094XdebugUsage problems (Wrong Results)public2004-10-06 21:272004-11-28 22:54
Reporterratchet 
Assigned To 
PrioritynormalSeveritymajorReproducibilityrandom
StatusclosedResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000094: xdebug_sprintf misbehaves with x86_64/glibc-2.3.3
DescriptionSpecifically, using PHP CLI, xdebug_path_to_url produces either either a path of just "file://" [^] or "file:///<garbage>" [^] followed by a partial path.

Also, with PHP compiled with --enable-debug and xdebug.loaded with "zend_extension_debug=/path/to/xdebug.so" it simply segfaults in xdebug_sprintf after connecting to the listener.
Additional InformationAccording to Linux's vsnprintf man page, va_start and va_end should occur within the for(;;) loop used to calculate the result buffer's length. Patching xdebug_str.c as follows fixes the problem, and I am now able to step through PHP scripts with Komodo(!!!) using 64-bit PHP CLI and Xdebug.

Note, though, that this may not work with older versions of glibc or with other architecutres' or operating systems' versions of vsnprintf.

Index: xdebug_str.c
===================================================================
RCS file: /repository/xdebug/xdebug_str.c,v
retrieving revision 1.5
diff -u -r1.5 xdebug_str.c
--- xdebug_str.c 17 Dec 2003 20:50:27 -0000 1.5
+++ xdebug_str.c 6 Oct 2004 18:24:19 -0000
@@ -88,9 +88,10 @@

        new_str = (char *) xdmalloc(size);

- va_start(args, fmt);
        for (;;) {
+ va_start(args, fmt);
                int n = vsnprintf(new_str, size, fmt, args);
+ va_end(args);
                if (n > -1 && n < size) {
                        break;
                }
@@ -101,7 +102,6 @@
                }
                new_str = (char *) xdrealloc(new_str, size);
        }
- va_end(args);

        return new_str;
 }
TagsNo tags attached.
Operating System
PHP Version4.3.4
Attached Files

- Relationships

-  Notes
(0000218)
derick (administrator)
2004-11-28 22:54

Fixed in CVS. Your patch was almost correct, and I committed a similar one. I do not believe that it can break on other systems and, for that matter, it works fine for me.

- Issue History
Date Modified Username Field Change
2004-10-06 21:27 ratchet New Issue
2004-11-28 22:54 derick Status new => closed
2004-11-28 22:54 derick Note Added: 0000218
2016-07-31 13:36 derick Category Usage problems => Usage problems (Crashes)
2016-07-31 13:38 derick Category Usage problems (Crashes) => Usage problems (Wrong Results)


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker