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@entry=0x0, desc=desc@entry=0x68ee78, nparam=nparam@entry=0) at 
gbx_exec.c:1620
  #11 0x0000000000404869 in main (argc=1, argv=0x7fffffffe678) at gbx.c:416

Regards,
Tobi





------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Gambas-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to