more integer conversion tests and fixes
diff --git a/src/qcbor_decode.c b/src/qcbor_decode.c
index f5995fe..03e8b28 100644
--- a/src/qcbor_decode.c
+++ b/src/qcbor_decode.c
@@ -2820,10 +2820,10 @@
const uint8_t *pByte = BigNum.ptr;
size_t uLen = BigNum.len;
while(uLen--) {
- if(uResult > uMax >> 8) {
+ if(uResult > (uMax >> 8)) {
return QCBOR_ERR_CONVERSION_UNDER_OVER_FLOW;
}
- uResult = (uResult << 8) + *pByte;
+ uResult = (uResult << 8) + *pByte++;
}
*pResult = uResult;
@@ -2843,7 +2843,7 @@
is too large to fit. No error will be logged.
TODO: should an error be logged? */
while(uLen--) {
- dResult = (dResult * 256.0) + (double)*pByte;
+ dResult = (dResult * 256.0) + (double)*pByte++;
}
return dResult;