Commit a75b247f authored by Lev Walkin's avatar Lev Walkin

remove undefined behavior sanitizer warning

parent 0368c628
...@@ -189,8 +189,7 @@ load_object_from(const char *fname, enum expectation expectation, unsigned char ...@@ -189,8 +189,7 @@ load_object_from(const char *fname, enum expectation expectation, unsigned char
fbuf_left, fbuf_offset, size); fbuf_left, fbuf_offset, size);
assert(fbuf_offset == (ssize_t)size); assert(fbuf_offset == (ssize_t)size);
} else { } else {
assert(fbuf_offset - size < 2 assert((fbuf_offset + 1 /* "\n" */ == (ssize_t)size
|| (fbuf_offset + 1 /* "\n" */ == (ssize_t)size
&& fbuf[size - 1] == '\n') && fbuf[size - 1] == '\n')
|| (fbuf_offset + 2 /* "\r\n" */ == (ssize_t)size || (fbuf_offset + 2 /* "\r\n" */ == (ssize_t)size
&& fbuf[size - 2] == '\r' && fbuf[size - 2] == '\r'
......
...@@ -189,8 +189,7 @@ load_object_from(const char *fname, enum expectation expectation, unsigned char ...@@ -189,8 +189,7 @@ load_object_from(const char *fname, enum expectation expectation, unsigned char
fbuf_left, fbuf_offset, size); fbuf_left, fbuf_offset, size);
assert(fbuf_offset == (ssize_t)size); assert(fbuf_offset == (ssize_t)size);
} else { } else {
assert(fbuf_offset - size < 2 assert((fbuf_offset + 1 /* "\n" */ == (ssize_t)size
|| (fbuf_offset + 1 /* "\n" */ == (ssize_t)size
&& fbuf[size - 1] == '\n') && fbuf[size - 1] == '\n')
|| (fbuf_offset + 2 /* "\r\n" */ == (ssize_t)size || (fbuf_offset + 2 /* "\r\n" */ == (ssize_t)size
&& fbuf[size - 2] == '\r' && fbuf[size - 2] == '\r'
......
...@@ -190,8 +190,7 @@ load_object_from(const char *fname, unsigned char *fbuf, size_t size, enum encty ...@@ -190,8 +190,7 @@ load_object_from(const char *fname, unsigned char *fbuf, size_t size, enum encty
fbuf_left, fbuf_offset, size); fbuf_left, fbuf_offset, size);
assert(fbuf_offset == (ssize_t)size); assert(fbuf_offset == (ssize_t)size);
} else { } else {
assert(fbuf_offset - size < 2 assert((fbuf_offset + 1 /* "\n" */ == (ssize_t)size
|| (fbuf_offset + 1 /* "\n" */ == (ssize_t)size
&& fbuf[size - 1] == '\n') && fbuf[size - 1] == '\n')
|| (fbuf_offset + 2 /* "\r\n" */ == (ssize_t)size || (fbuf_offset + 2 /* "\r\n" */ == (ssize_t)size
&& fbuf[size - 2] == '\r' && fbuf[size - 2] == '\r'
......
...@@ -25,7 +25,7 @@ main() { ...@@ -25,7 +25,7 @@ main() {
printf("Checking uper_open_type_put():\n"); printf("Checking uper_open_type_put():\n");
assert(0 == uper_open_type_put(&asn_DEF_T, 0, &t, &po)); assert(0 == uper_open_type_put(&asn_DEF_T, 0, &t, &po));
assert(po.nbits == (-1 + sizeof(po.tmpspace)) * 8); assert(po.nbits == (-1 + (int)sizeof(po.tmpspace)) * 8);
printf("po{nboff=%zd; nbits=%zd; buffer=%p; tmpspace=%p}\n", printf("po{nboff=%zd; nbits=%zd; buffer=%p; tmpspace=%p}\n",
po.nboff, po.nbits, po.buffer, po.tmpspace); po.nboff, po.nbits, po.buffer, po.tmpspace);
/* One byte length and one byte 0x00 */ /* One byte length and one byte 0x00 */
......
...@@ -154,8 +154,7 @@ load_object_from(enum expectation expectation, unsigned char *fbuf, size_t size, ...@@ -154,8 +154,7 @@ load_object_from(enum expectation expectation, unsigned char *fbuf, size_t size,
if(how == AS_DER) { if(how == AS_DER) {
assert(fbuf_offset == (ssize_t)size); assert(fbuf_offset == (ssize_t)size);
} else { } else {
assert(fbuf_offset - size < 2 assert((fbuf_offset + 1 /* "\n" */ == (ssize_t)size
|| (fbuf_offset + 1 /* "\n" */ == (ssize_t)size
&& fbuf[size - 1] == '\n') && fbuf[size - 1] == '\n')
|| (fbuf_offset + 2 /* "\r\n" */ == (ssize_t)size || (fbuf_offset + 2 /* "\r\n" */ == (ssize_t)size
&& fbuf[size - 2] == '\r' && fbuf[size - 2] == '\r'
......
...@@ -143,8 +143,7 @@ load_object_from(enum expectation expectation, unsigned char *fbuf, size_t size, ...@@ -143,8 +143,7 @@ load_object_from(enum expectation expectation, unsigned char *fbuf, size_t size,
if(how == AS_DER) { if(how == AS_DER) {
assert(fbuf_offset == (ssize_t)size); assert(fbuf_offset == (ssize_t)size);
} else { } else {
assert(fbuf_offset - size < 2 assert((fbuf_offset + 1 /* "\n" */ == (ssize_t)size
|| (fbuf_offset + 1 /* "\n" */ == (ssize_t)size
&& fbuf[size - 1] == '\n') && fbuf[size - 1] == '\n')
|| (fbuf_offset + 2 /* "\r\n" */ == (ssize_t)size || (fbuf_offset + 2 /* "\r\n" */ == (ssize_t)size
&& fbuf[size - 2] == '\r' && fbuf[size - 2] == '\r'
......
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