BUG: JScript Err Object May Return Incorrect Results (321494)



The information in this article applies to:

  • Microsoft Windows Script Host 2.0

This article was previously published under Q321494

SYMPTOMS

When you use the Err object in Microsoft JScript, an incorrect result may return when the output from the Err object is used.

CAUSE

There is a bug in the constructor of the Jscript Err object that may cause the Err object to return an incorrect result. The problem occurs because memory is not initialized properly in the Jscript Err object.

RESOLUTION

Because of the nature of the bug, the only way to work around the problem is to make changes to the data that is submitted to the Err object.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

You can use the following code to reproduce the problem:
//******************************************
var message = "test1test1";
message = message.replace("test1", "test2");
var e = new Error(0xFFFF, message); 
WScript.echo(e.number.toString(16));
//******************************************
				

You can use the following code to work around the problem:
//******************************************
var message = "test1test1";
message = message.replace("test1", "test2");
var e = new Error(0xFFFF, message.toString()); 
WScript.echo(e.number.toString(16));
//******************************************
				

Modification Type:MinorLast Reviewed:3/20/2004
Keywords:kbDSWManage2003Swept kbbug kbpending KB321494