Bug #28250 Run-Time Check Failure #3 - The variable 'value' is being used without being def
Submitted: 4 May 2007 16:09 Modified: 18 Jun 2007 19:45
Reporter: Antony Curtis Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.1, 5.0 OS:Windows (XP (32bit))
Assigned to: Martin Hansson CPU Architecture:Any

[4 May 2007 16:09] Antony Curtis
Description:
After building debug binaries using Visual C++ 2005, I get the following failure when running mysql-test-run. 

Run-Time Check Failure #3 - The variable 'value' is being used without being defined.

I have attached the debugger and the error occurs at line996 of item_func.cc which is the "return value;" statement. Variable value is not written to if argument is null.

How to repeat:
C:\Perl\bin\perl.exe ./mysql-test-run.pl cast

Suggested fix:
Suggest the following change:

Initialize value to 0 in function Item_func_unsigned::val_int();
[4 May 2007 16:12] Antony Curtis
The statement being executed when the runtime error occurrs is:

select cast(NULL as unsigned), cast(1/0 as unsigned)
[7 May 2007 17:06] MySQL Verification Team
Thank you for the bug report.
[22 May 2007 8:11] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/27113

ChangeSet@1.2490, 2007-05-22 10:26:21+02:00, mhansson@dl145s.mysql.com +1 -0
  Bug #28250: Run-Time Check Failure #3 - The variable 'value' is being used without 
  being def
  
  Inside method Item_func_unsigned::val_int, the variable value can be returned 
  without being assigned. This gives a run-time error when building debug binaries
  using Visual C++ 2005.
  
  Solution: Initialize value to 0.
[23 May 2007 12:27] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/27211

ChangeSet@1.2490, 2007-05-23 14:43:06+02:00, mhansson@dl145s.mysql.com +2 -0
  Bug #28250: Run-Time Check Failure #3 - The variable 'value' is 
  being used without being def
  
  Inside method Item_func_unsigned::val_int, the variable value 
  can be returned without being initialized when the CAST argument
  is of type DECIMAL and has a NULL value. This gives a run-time 
  error when building debug binaries using Visual C++ 2005.
  
  Solution: Initialize value to 0
[4 Jun 2007 21:21] Bugs System
Pushed into 5.1.20-beta
[4 Jun 2007 21:23] Bugs System
Pushed into 5.0.44
[18 Jun 2007 19:45] Paul DuBois
Noted in 5.0.44, 5.1.20 changelogs.