[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [vxi] RE: OpenVXI go poof

Ok, have a fix. The problem is in OSBjsi, the SpiderMonkey ECMAScript integration. When an array object is defined, the names of the contained properties returned by SpiderMonkey are of type integer, not of type string as they are for non-array objects. Here's the fix, which adds handling for integers (for non-integers code further down will simply return an error instead of crashing, but I'm quite sure the object properties are named via ints or strings, never anything else).

< 	    const jschar *name = JS_GetStringChars (JSVAL_TO_STRING (prName));
< 	    size_t namelen = JS_GetStringLength(JSVAL_TO_STRING (prName));
> 	    const jschar *name = NULL;
> 	    size_t namelen = 0;
> 	    if ( JSVAL_IS_STRING (prName) ) {
> 	      name = JS_GetStringChars (JSVAL_TO_STRING (prName));
> 	      namelen = JS_GetStringLength (JSVAL_TO_STRING (prName));
> 	    } else if ( JSVAL_IS_INT (prName) ) {
> 	      JSString *str = JS_ValueToString (context, prName);
> 	      name = JS_GetStringChars (str);
> 	      namelen = JS_GetStringLength (str);
> 	    }


-----Original Message-----
From: vxi-discuss@metronomicon.com
[mailto:vxi-discuss@metronomicon.com]On Behalf Of Tracy Boehrer
Sent: Friday, May 17, 2002 12:37 AM
To: vxi-discuss@speechinfo.org
Subject: [vxi] RE: OpenVXI go poof

Correction:  The exception happens on the call to "JS_GetStringChars", which is a few lines down from the line I listed below.

	-----Original Message----- 
	From: Tracy Boehrer 
	Sent: Thu 5/16/2002 11:33 PM 
	To: vxi-discuss@speechinfo.org 
	Subject: OpenVXI go poof

	With the script below, OpenVXI will throw an exception, and either hang or crash when the <submit> element is processed.  The script is trying to submit a JavaScript object.  The hang or crash may be a side effect of the exception being uncaught until it hit my application code, and OpenVXI is in some funky state.

	The problem starts in JsiContext::JsvalToVXIValue, after the line "jsval prName = JSVAL_VOID, prVal = JSVAL_VOID;".  It seems that prName is an error value, and the next line takes a dump.

	Hopefully someone smart than me can shed some light in this...


	<?xml version="1.0"?>

	<vxml version="2.0">

	   var foo = new Object;
	   foo[0] = 1;
	   foo[1] = 7;
	   foo[2] = "hello";

	  <form id="form">
	    <block><prompt>Simple Text</prompt></block>

	    <field name="fact">
	      <grammar>hi {hello} | bye {goodbye} </grammar>
	      <prompt>This is a prompt</prompt>
	        <submit next="http://localhost/bar.jsp"; namelist="foo"/>


This page is maintained by Alan W Black (awb@cs.cmu.edu)
speechinfo.org is hosted on a machine donated by VA Linux Systems
VA Linux Systems