Bug 5329 - String to Integer conversion contradicts new April 2005 Conversion Rules
Summary: String to Integer conversion contradicts new April 2005 Conversion Rules
Status: CLOSED CODE_FIX
Alias: None
Product: ACPI
Classification: Unclassified
Component: ACPICA-Core (show other bugs)
Hardware: i386 Linux
: P2 normal
Assignee: Robert Moore
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-29 10:13 UTC by Valery A Podrezov
Modified: 2006-09-28 13:11 UTC (History)
2 users (show)

See Also:
Kernel Version: 2.6
Subsystem:
Regression: ---
Bisected commit-id:


Attachments
ASL code to reproduce bug. (2.28 KB, text/plain)
2005-09-29 10:17 UTC, Valery A Podrezov
Details
Proposed patch (5.73 KB, patch)
2006-02-03 03:59 UTC, Valery A Podrezov
Details | Diff

Description Valery A Podrezov 2005-09-29 10:13:49 UTC
Most recent kernel where this bug did not occur:
Distribution:
Hardware Environment:
Software Environment:
Problem Description:

The Linux kernel ACPI interpreter fails the following
AML test when it is compiled into a simulator. So if an
OEM BIOS includes this code, Linux would fail.

Steps to reproduce:

Run interpreter with the .asl demo code attached below.
Comment 1 Valery A Podrezov 2005-09-29 10:17:14 UTC
Created attachment 6187 [details]
ASL code to reproduce bug.

The examples given in the attached demo program strictly follow
the new (April 2005) Data Type Conversion Rules specs (17.2.5.7)
and show the following contradictions with them:

  Bug 1: Add("0x1111", 0)		- returns 0x1111 but the correct value
is 0.
  Bug 2: Add("00000000000012345678", 0) - returns 0x12345678 but the correct
value is 0x1234.
  Bug 3: Add("12345678901234560", 0)	- causes AE_BAD_HEX_CONSTANT exception,
but should not.


INTERNAL BUG NUMBER

   63
Comment 2 Valery A Podrezov 2006-02-03 03:59:56 UTC
Created attachment 7224 [details]
Proposed patch

TESTED:

The update was tested by the ASLTS test suite runs
(all the test cases) on the following systems:

- CYGWIN_NT-5.1 1.5.18(0.132/4/2) 2005-07-02 20:30 i686 unknown unknown Cygwin
- Linux 2.6.5-7.191-smp #1 SMP Tue Jun 28 14:58:56 UTC 2005 i686 i686 i386
GNU/Linux

for the following modes supported by the ASLTS test suite:

- 32-bit norm mode
- 64-bit norm mode
- 64-bit slack mode
# 32-bit slack mode (currently impossible to run tests
		     in this mode due to Bug 198)

The tests were run (on the systems described above) before update,
then the tests were run on those systems after update. Then results
of two runs were compared. All is Ok (the relevant error fixed, no
new errors).


SUPPORTED FEATURES (of ToInteger AML operator and Implicit
		    Conversion from String to Integer).

Particular cases of String-image of Data:

 1. "0x1234cd" ('0x' works for ToInteger only)
    Result:
    ToInteger -->> 0x1234cd
    Implicit Conversion -->> 0
 2. " 0x1234cd" (white space before image of Data is skipped)
    ToInteger -->> 0x1234cd
    Implicit -->> 0
 3. "1234" (image without '0x': ToInteger-->>decimal; Implicit-->>hex)
    ToInteger -->> 1234
    Implicit -->> 0x1234
 4. "0000000000000000000000001234" (zeros before significant characters
				    in image without '0x' are skipped).
    ToInteger -->> 1234
    Implicit -->> 0x1234

Exceptions of ToInteger occur in the following cases:

 5. "1234cd"		  (non-decimal character in dec-image).
 6. "000x1234"		  (non-decimal character in dec-image).
 7. "0x1234cdQ" 	  (non-hex character in '0x'-image).
 8. "1234 "		  (white space in dec image).
 9. "0x1234cd " 	  (white space in '0x'-image).
10. "0x 1234cdQ"	  (white space after '0x').
11. (decimal image exceeding maximal).
    32-bit mode
Comment 3 Robert Moore 2006-05-26 12:27:09 UTC
Fix integrated into ACPICA version 20060526
Comment 4 Len Brown 2006-06-25 21:41:30 UTC
ACPICA 20060608 shipped in Linux 2.6.17-git9, closed. 

Note You need to log in before you can comment on or make changes to this bug.