diff options
author | Chris Liddell <chris.liddell@artifex.com> | 2020-09-23 20:20:59 +0100 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2020-09-24 09:56:10 +0100 |
commit | d7d05e0ef54662054e038b421795e6e7dedd1e4a (patch) | |
tree | 30a76069d51e17a3411741be5cbfead5dbc71325 /base/gsparam.c | |
parent | 038df4baf368196942cd32aedcd29e4916a190c8 (diff) | |
download | ghostpdl-d7d05e0ef54662054e038b421795e6e7dedd1e4a.tar.gz |
Bug 702920: Fix type confusion in new param type code.
In a few cases we were using the wrong element in the union to read the
value back from the param list (and to range check the values).
Diffstat (limited to 'base/gsparam.c')
-rw-r--r-- | base/gsparam.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/base/gsparam.c b/base/gsparam.c index a57415651..9a7ea0f85 100644 --- a/base/gsparam.c +++ b/base/gsparam.c @@ -200,7 +200,7 @@ param_coerce_typed(gs_param_typed_value * pvalue, gs_param_type req_type, } case gs_param_type_float: { - float fl = (float)pvalue->value.l; + float fl = (float)pvalue->value.i; pvalue->value.f = fl; goto ok; } @@ -274,9 +274,9 @@ param_coerce_typed(gs_param_typed_value * pvalue, gs_param_type req_type, } case gs_param_type_int: { - int int1 = (int)pvalue->value.l; + int int1 = (int)pvalue->value.i64; #if ARCH_SIZEOF_INT < 8 /* sizeof(int64_t) */ - if (pvalue->value.i64 != (int)int1) + if (pvalue->value.i64 != (int64_t)int1) return_error(gs_error_rangecheck); #endif pvalue->value.i = int1; @@ -309,9 +309,9 @@ param_coerce_typed(gs_param_typed_value * pvalue, gs_param_type req_type, } case gs_param_type_long: { - long l = (long)pvalue->value.i64; + long l = (long)pvalue->value.z; #if ARCH_SIZEOF_LONG < 8 /* sizeof(int64_t) */ - if (pvalue->value.i64 != (int64_t)l) + if (pvalue->value.z != (size_t)l) return_error(gs_error_rangecheck); #endif pvalue->value.l = l; @@ -319,9 +319,9 @@ param_coerce_typed(gs_param_typed_value * pvalue, gs_param_type req_type, } case gs_param_type_int: { - int int1 = (int)pvalue->value.l; + int int1 = (int)pvalue->value.z; #if ARCH_SIZEOF_INT < 8 /* sizeof(int64_t) */ - if (pvalue->value.i64 != (int)int1) + if (pvalue->value.z != (size_t)int1) return_error(gs_error_rangecheck); #endif pvalue->value.i = int1; @@ -329,7 +329,7 @@ param_coerce_typed(gs_param_typed_value * pvalue, gs_param_type req_type, } case gs_param_type_float: { - float fl = (float)pvalue->value.i64; + float fl = (float)pvalue->value.z; pvalue->value.f = fl; goto ok; } |