Subj : problems with error reporting To : netscape.public.mozilla.jseng From : Silviu Trasca Date : Wed Jun 22 2005 02:08 am This is a multi-part message in MIME format. --------------070305040708030002020107 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, I'm embedding SpiderMonkey in my app and have problems (invalid memory reads) with error reporting for lines of code greater than 256 characters. I'm using an error handler similar with the one in js/js.c .. I was able to reproduce the problem with "js" shell only (see the valgrind output bellow). SpiderMonkey is compiled in thread safe mode, on FC3. Thanks, Silviu [silviu@home-tx0275arsq js]$ valgrind --tool=memcheck ./js ==10403== Memcheck, a memory error detector for x86-linux. ==10403== Copyright (C) 2002-2004, and GNU GPL'd, by Julian Seward et al. ==10403== Using valgrind-2.2.0, a program supervision framework for x86-linux. ==10403== Copyright (C) 2000-2004, and GNU GPL'd, by Julian Seward et al. ==10403== For more details, rerun with: -v ==10403== js>MM_preloadImages('/images/nav_catalog_f2.gif','/images/nav_new_f2.gif','/images/nav_acad_f2.gif','/images/nav_about_f2.gif','/images/top_contact_on.gif,'/images/top_booksellers_on.gif,'/images/top_map_on.gif,'/images/top_cart_on.gif,'/images/top_home_on.gif); 1: SyntaxError: unterminated string literal: 1: if); 1: ......==10403== Invalid read of size 1 ==10403== at 0x804A880: my_ErrorReporter (in /home/silviu/projects/js/js) ==10403== by 0x8077AC4: js_ReportUncaughtException (in /home/silviu/projects/js/js) ==10403== by 0x804E563: JS_CompileScript (in /home/silviu/projects/js/js) ==10403== by 0x8049407: Process (in /home/silviu/projects/js/js) ==10403== Address 0x1B969986 is 0 bytes after a block of size 6 alloc'd ==10403== at 0x1B902A90: malloc (vg_replace_malloc.c:131) ==10403== by 0x80B9F90: js_GetStringBytes (in /home/silviu/projects/js/js) ==10403== by 0x804F45D: JS_GetStringBytes (in /home/silviu/projects/js/js) ==10403== by 0x80ABEB4: js_ReportCompileErrorNumber (in /home/silviu/projects/js/js) ....................................................................................................................................................................................................................................^ js> --------------070305040708030002020107 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi,
I'm embedding SpiderMonkey in my app and have problems (invalid memory reads) with error reporting for lines of code greater than 256 characters. I'm using an error  handler similar with the one in js/js.c .. I was able to reproduce the problem with "js" shell only (see the valgrind output bellow). SpiderMonkey is compiled in thread safe mode, on FC3.

Thanks,
Silviu


[silviu@home-tx0275arsq js]$ valgrind --tool=memcheck ./js
==10403== Memcheck, a memory error detector for x86-linux.
==10403== Copyright (C) 2002-2004, and GNU GPL'd, by Julian Seward et al.
==10403== Using valgrind-2.2.0, a program supervision framework for x86-linux.
==10403== Copyright (C) 2000-2004, and GNU GPL'd, by Julian Seward et al.
==10403== For more details, rerun with: -v
==10403==
js>MM_preloadImages('/images/nav_catalog_f2.gif','/images/nav_new_f2.gif','/images/nav_acad_f2.gif','/images/nav_about_f2.gif','/images/top_contact_on.gif,'/images/top_booksellers_on.gif,'/images/top_map_on.gif,'/images/top_cart_on.gif,'/images/top_home_on.gif);
1: SyntaxError: unterminated string literal:
1: if);
1: ......==10403== Invalid read of size 1
==10403== at 0x804A880: my_ErrorReporter (in /home/silviu/projects/js/js)
==10403== by 0x8077AC4: js_ReportUncaughtException (in /home/silviu/projects/js/js)
==10403== by 0x804E563: JS_CompileScript (in /home/silviu/projects/js/js)
==10403== by 0x8049407: Process (in /home/silviu/projects/js/js)
==10403== Address 0x1B969986 is 0 bytes after a block of size 6 alloc'd
==10403== at 0x1B902A90: malloc (vg_replace_malloc.c:131)
==10403== by 0x80B9F90: js_GetStringBytes (in /home/silviu/projects/js/js)
==10403== by 0x804F45D: JS_GetStringBytes (in /home/silviu/projects/js/js)
==10403== by 0x80ABEB4: js_ReportCompileErrorNumber (in
/home/silviu/projects/js/js)
....................................................................................................................................................................................................................................^
js>

--------------070305040708030002020107-- .