Commit ef3efb43 authored by Bob Moore's avatar Bob Moore Committed by Rafael J. Wysocki

ACPICA: iASL: Return exceptions for string-to-integer conversions

This allows iASL to generate errors by passing exceptions that may be
encountered during string-to-integer conversions. The exceptions
point out invalid hex, decimal, and octal integers.

ACPICA commit e98b8c0a3d96fdabb167c0ef18a809b32ade3228

Link: https://github.com/acpica/acpica/commit/e98b8c0aSigned-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarErik Kaneda <erik.kaneda@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 18aaa02c
...@@ -45,10 +45,15 @@ acpi_status acpi_ut_convert_octal_string(char *string, u64 *return_value_ptr) ...@@ -45,10 +45,15 @@ acpi_status acpi_ut_convert_octal_string(char *string, u64 *return_value_ptr)
/* Convert each ASCII byte in the input string */ /* Convert each ASCII byte in the input string */
while (*string) { while (*string) {
/*
/* Character must be ASCII 0-7, otherwise terminate with no error */ * Character must be ASCII 0-7, otherwise:
* 1) Runtime: terminate with no error, per the ACPI spec
* 2) Compiler: return an error
*/
if (!(ACPI_IS_OCTAL_DIGIT(*string))) { if (!(ACPI_IS_OCTAL_DIGIT(*string))) {
#ifdef ACPI_ASL_COMPILER
status = AE_BAD_OCTAL_CONSTANT;
#endif
break; break;
} }
...@@ -94,10 +99,15 @@ acpi_status acpi_ut_convert_decimal_string(char *string, u64 *return_value_ptr) ...@@ -94,10 +99,15 @@ acpi_status acpi_ut_convert_decimal_string(char *string, u64 *return_value_ptr)
/* Convert each ASCII byte in the input string */ /* Convert each ASCII byte in the input string */
while (*string) { while (*string) {
/*
/* Character must be ASCII 0-9, otherwise terminate with no error */ * Character must be ASCII 0-9, otherwise:
* 1) Runtime: terminate with no error, per the ACPI spec
* 2) Compiler: return an error
*/
if (!isdigit(*string)) { if (!isdigit(*string)) {
#ifdef ACPI_ASL_COMPILER
status = AE_BAD_DECIMAL_CONSTANT;
#endif
break; break;
} }
...@@ -143,10 +153,15 @@ acpi_status acpi_ut_convert_hex_string(char *string, u64 *return_value_ptr) ...@@ -143,10 +153,15 @@ acpi_status acpi_ut_convert_hex_string(char *string, u64 *return_value_ptr)
/* Convert each ASCII byte in the input string */ /* Convert each ASCII byte in the input string */
while (*string) { while (*string) {
/*
/* Must be ASCII A-F, a-f, or 0-9, otherwise terminate with no error */ * Character must be ASCII A-F, a-f, or 0-9, otherwise:
* 1) Runtime: terminate with no error, per the ACPI spec
* 2) Compiler: return an error
*/
if (!isxdigit(*string)) { if (!isxdigit(*string)) {
#ifdef ACPI_ASL_COMPILER
status = AE_BAD_HEX_CONSTANT;
#endif
break; break;
} }
......
...@@ -40,12 +40,12 @@ ...@@ -40,12 +40,12 @@
struct acpi_exception_info { struct acpi_exception_info {
char *name; char *name;
#ifdef ACPI_HELP_APP #if defined (ACPI_HELP_APP) || defined (ACPI_ASL_COMPILER)
char *description; char *description;
#endif #endif
}; };
#ifdef ACPI_HELP_APP #if defined (ACPI_HELP_APP) || defined (ACPI_ASL_COMPILER)
#define EXCEP_TXT(name,description) {name, description} #define EXCEP_TXT(name,description) {name, description}
#else #else
#define EXCEP_TXT(name,description) {name} #define EXCEP_TXT(name,description) {name}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment