[Gambas-user] [Gambas Bug Tracker] Bug #894: gb.xml: XmlDocument.FromString(Null) crashes

bugtracker at ...3416... bugtracker at ...3416...
Sat Feb 6 18:25:15 CET 2016


http://gambaswiki.org/bugtracker/edit?object=BUG.894&from=L21haW4-

Tobias BOEGE reported a new bug.

Summary
-------

gb.xml: XmlDocument.FromString(Null) crashes

Type             : Bug
Priority         : Low
Gambas version   : 3.8.90 (TRUNK)
Product          : Unknown


Description
-----------

Hi Adrien,

gb.xml crashes with:

  Public Sub Main()
    Dim h As New XmlDocument

    h.FromString(Null)
  End

(Note that h.FromString("") works.) gdb indicates that some arithmetic in your utils.cpp:memchrs()
is wrong (from frame #2 to #1 the length increases from 0 to 1 which is deadly for NULL pointers):

  Program received signal SIGSEGV, Segmentation fault.
  0x00007ffff7abb118 in memchr () from /usr/lib/libc.so.6
  (gdb) bt
  #0  0x00007ffff7abb118 in memchr () from /usr/lib/libc.so.6
  #1  0x00007ffff63bf630 in memchr (__n=1, __c=<optimized out>, __s=0x0) at /usr/include/string.h:81
  #2  memchrs (source=0x0, lensource=0, comp=0x7ffff63c5964 "<?xml ", lencomp=6) at utils.cpp:142
  #3  0x00007ffff63c0f9a in XMLDocument_SetContent (doc=0x68f420, content=0x0, len=0) at document.cpp:117
  #4  0x00007ffff63c31fc in CDocument_fromString (_object=<optimized out>, _param=<optimized out>) at CDocument.cpp:94
  #5  0x0000000000431282 in EXEC_native () at gbx_exec.c:1366
  #6  0x0000000000431b15 in EXEC_native_check (defined=<optimized out>) at gbx_exec.c:1163
  #7  0x000000000043b65b in EXEC_loop () at gbx_exec_loop.c:1159
  #8  0x00000000004300e5 in EXEC_function_loop () at gbx_exec.c:931
  #9  0x0000000000430a1e in EXEC_function_real () at gbx_exec.c:895
  #10 0x0000000000432094 in EXEC_public_desc (class=<optimized out>, object=object at ...2861...=0x0, desc=desc at ...2861...=0x68ee78, nparam=nparam at ...2861...=0) at gbx_exec.c:1620
  #11 0x0000000000404869 in main (argc=1, argv=0x7fffffffe678) at gbx.c:416

Regards,
Tobi








More information about the User mailing list