FIX: Access violation occurs when an RPC call is made that includes a bit parameter value that is not valid

Article translations Article translations
Article ID: 314128
This article was previously published under Q314128
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 356323 (SHILOH_BUGS)
Expand all | Collapse all

On This Page

Symptoms

In SQL Server 2000 Service Pack 2 (SP2), when you run a SQL Profiler trace that includes RPC events (RPC:Starting or RPC:Completed), a statement that includes a bit parameter that has a value that is greater than 9 causes an access violation in CNetInputBuffer::Init.

In SQL Server 2000 Service Pack 1 (SP1), the trace is truncated, and you receive an error message in SQL Profiler, but no access violation occurs in SQL Server. The data type of the table column is irrelevant; only the data type of the parameter is relevant to this problem.

NOTE: The table column may be another type other than bit.

SQL Server 2000 SP2 (8.00.534) generates the following stack dump:
   Short Stack Dump

   00410B23 Module(sqlservr+00010B23) (CNetInputBuffer::Init+0000005C)
   004B7422 Module(sqlservr+000B7422) (CNetInputStream::FAddEventFragment+0000005E)
   00639EB1 Module(sqlservr+00239EB1) (PcnisGetRpcTraceInput+000004BB)
   0063A2C1 Module(sqlservr+0023A2C1) (PostRPC+000000AB)
   00605A07 Module(sqlservr+00205A07) (execrpc+0000095E)
   00437E05 Module(sqlservr+00037E05) (execute_rpc+00000019)
   00410E73 Module(sqlservr+00010E73) (process_commands+00000210)
   41073379 Module(UMS+00003379) (ProcessWorkRequests+0000024A)
   41073071 Module(UMS+00003071) (ThreadStartRoutine+000000BD)
   7800A27B Module(MSVCRT+0000A27B) (beginthread+000000CE)
   77E8758A Module(KERNEL32+0000758A) (SetFilePointer+0000018A)
				

Resolution

Service pack information

To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
290211 How to obtain the latest SQL Server 2000 service pack

Hotfix information

NOTE: The following hotfix was created before the release of Microsoft SQL Server 2000 Service Pack 3.

The English version of this fix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
   Date         Version    Size     File name
   ------------------------------------------------

   12-DEC-2001  8.00.552   7,442,513  Sqlservr.exe
				
NOTE: Because of file dependencies, the most recent hotfix or feature that contains these files may also contain additional files.


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section. This problem was first corrected in Microsoft SQL Server 2000 Service Pack 4.

More information

To reproduce the access violation, run a SQL Profiler trace that includes at least one of the RPC events (RPC:Starting or RPC:Completed), and then run the following C code:
	long int myBitStatus=0xff; //Invalid value

	SQLRETURN   retcode;
	SQLHENV     henv = NULL;
	SQLHDBC     hdbc = NULL;
	SQLHSTMT    hstmt = NULL;

	PTSTR       szDataSource = _T("localserver");
	PTSTR       szUID = _T("sa");
	PTSTR       szPWD = _T("sa_password");

	if (SQLAllocHandle(SQL_HANDLE_ENV, NULL, &henv) == SQL_ERROR)
		return 1;
	SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (void*) SQL_OV_ODBC3,
	SQL_IS_INTEGER);

	if (SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc) == SQL_ERROR)
		return 1;

	if (SQLConnect(hdbc, (SQLTCHAR*) szDataSource, SQL_NTS,
	(SQLTCHAR*) szUID, SQL_NTS, (SQLTCHAR*) szPWD, SQL_NTS) == SQL_ERROR)
		return 1;

	if (SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt) == SQL_ERROR)
		return 1;

	retcode = SQLAllocHandle(hstmt, hdbc, &hstmt);
	retcode=SQLBindParameter(hstmt, 
				 1, 
				 SQL_PARAM_INPUT, 
				 SQL_C_BIT,
				 SQL_BIT, 
				 1, 
				 0, 
				 &myBitStatus, 
				 0, 
				 &myBitStatus);

	if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
	{
		retcode = SQLExecDirect (hstmt, "SELECT au_id FROM pubs.dbo.authors WHERE contract = ?", SQL_NTS);
	}
				
This access violation occurs when the server is running SQL Server 2000 SP2; the SQL Profiler tool version does not affect this problem.

Properties

Article ID: 314128 - Last Review: October 26, 2013 - Revision: 6.0
Keywords: 
kbnosurvey kbarchive kbhotfixserver kbqfe kbbug kbfix kbsqlserv2000presp3fix KB314128

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com