Browse Source

Remove always true checks.

See https://github.com/google/oss-fuzz/issues/953

```
/src/open62541/src/ua_types_encoding_binary.c:389:42: error: comparison 'u32' (aka 'unsigned int') <= 4294967295 is always true [-Werror,-Wtautological-constant-compare]
        (decoded >= 0xff800001 && decoded <= 0xffffffff)) *dst = NAN;
                                  ~~~~~~~ ^  ~~~~~~~~~~
 /src/open62541/src/ua_types_encoding_binary.c:425:51: error: comparison 'u64' (aka 'unsigned long') <= 18446744073709551615 is always true [-Werror,-Wtautological-constant-compare]
        (decoded >= 0xfff0000000000001L && decoded <= 0xffffffffffffffffL)) *dst = NAN;
                                           ~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~
```

Credit to oss-fuzz
Stefan Profanter 7 years ago
parent
commit
6d25250c8c
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/ua_types_encoding_binary.c

+ 2 - 2
src/ua_types_encoding_binary.c

@@ -386,7 +386,7 @@ Float_decodeBinary(UA_Float *dst, const UA_DataType *_) {
     else if(decoded == FLOAT_INF) *dst = INFINITY;
     else if(decoded == FLOAT_NEG_INF) *dst = -INFINITY;
     else if((decoded >= 0x7f800001 && decoded <= 0x7fffffff) ||
-       (decoded >= 0xff800001 && decoded <= 0xffffffff)) *dst = NAN;
+       (decoded >= 0xff800001)) *dst = NAN;
     else *dst = (UA_Float)unpack754(decoded, 32, 8);
     return UA_STATUSCODE_GOOD;
 }
@@ -422,7 +422,7 @@ Double_decodeBinary(UA_Double *dst, const UA_DataType *_) {
     else if(decoded == DOUBLE_NEG_INF) *dst = -INFINITY;
     //cppcheck-suppress redundantCondition
     else if((decoded >= 0x7ff0000000000001L && decoded <= 0x7fffffffffffffffL) ||
-       (decoded >= 0xfff0000000000001L && decoded <= 0xffffffffffffffffL)) *dst = NAN;
+       (decoded >= 0xfff0000000000001L)) *dst = NAN;
     else *dst = (UA_Double)unpack754(decoded, 64, 11);
     return UA_STATUSCODE_GOOD;
 }