Commit 77cdf2bd authored by Uri Blumenthal's avatar Uri Blumenthal

Address compiler warnings and compaints from Sanitizers (revealed

by Clang-12 from Xcode-12.5 on macOS Big Sur 11.4)
parent 73d2e980
...@@ -26,7 +26,7 @@ OCTET_STRING_print(const asn_TYPE_descriptor_t *td, const void *sptr, ...@@ -26,7 +26,7 @@ OCTET_STRING_print(const asn_TYPE_descriptor_t *td, const void *sptr,
* Dump the contents of the buffer in hexadecimal. * Dump the contents of the buffer in hexadecimal.
*/ */
buf = st->buf; buf = st->buf;
end = buf + st->size; end = (buf == NULL)? NULL : buf + st->size;
for(i = 0; buf < end; buf++, i++) { for(i = 0; buf < end; buf++, i++) {
if(!(i % 16) && (i || st->size > 16)) { if(!(i % 16) && (i || st->size > 16)) {
if(cb(scratch, p - scratch, app_key) < 0) if(cb(scratch, p - scratch, app_key) < 0)
......
...@@ -286,7 +286,7 @@ static ssize_t OCTET_STRING__convert_hexadecimal(void *sptr, const void *chunk_b ...@@ -286,7 +286,7 @@ static ssize_t OCTET_STRING__convert_hexadecimal(void *sptr, const void *chunk_b
static ssize_t OCTET_STRING__convert_binary(void *sptr, const void *chunk_buf, size_t chunk_size, int have_more) { static ssize_t OCTET_STRING__convert_binary(void *sptr, const void *chunk_buf, size_t chunk_size, int have_more) {
BIT_STRING_t *st = (BIT_STRING_t *)sptr; BIT_STRING_t *st = (BIT_STRING_t *)sptr;
const char *p = (const char *)chunk_buf; const char *p = (const char *)chunk_buf;
const char *pend = p + chunk_size; const char *pend = (p == NULL)? NULL : p + chunk_size;
int bits_unused = st->bits_unused & 0x7; int bits_unused = st->bits_unused & 0x7;
uint8_t *buf; uint8_t *buf;
......
...@@ -151,10 +151,10 @@ UTF8String_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, ...@@ -151,10 +151,10 @@ UTF8String_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
static ssize_t static ssize_t
UTF8String__process(const UTF8String_t *st, uint32_t *dst, size_t dstlen) { UTF8String__process(const UTF8String_t *st, uint32_t *dst, size_t dstlen) {
size_t length; size_t length = 0;
uint8_t *buf = st->buf; uint8_t *buf = (st == NULL)? NULL : st->buf;
uint8_t *end = buf + st->size; uint8_t *end = (buf == NULL)? NULL : buf + st->size;
uint32_t *dstend = dst + dstlen; uint32_t *dstend = (dst == NULL)? NULL : dst + dstlen;
for(length = 0; buf < end; length++) { for(length = 0; buf < end; length++) {
int ch = *buf; int ch = *buf;
......
...@@ -92,7 +92,7 @@ xer_decode__primitive_body(void *key, const void *chunk_buf, size_t chunk_size, ...@@ -92,7 +92,7 @@ xer_decode__primitive_body(void *key, const void *chunk_buf, size_t chunk_size,
} }
lead_wsp_size = xer_whitespace_span(chunk_buf, chunk_size); lead_wsp_size = xer_whitespace_span(chunk_buf, chunk_size);
chunk_buf = (const char *)chunk_buf + lead_wsp_size; chunk_buf += lead_wsp_size;
chunk_size -= lead_wsp_size; chunk_size -= lead_wsp_size;
bret = arg->prim_body_decoder(arg->type_descriptor, bret = arg->prim_body_decoder(arg->type_descriptor,
......
...@@ -94,7 +94,7 @@ uper_open_type_get_simple(const asn_codec_ctx_t *ctx, ...@@ -94,7 +94,7 @@ uper_open_type_get_simple(const asn_codec_ctx_t *ctx,
} }
buf = ptr; buf = ptr;
} }
if(per_get_many_bits(pd, buf + bufLen, 0, chunk_bytes << 3)) { if(per_get_many_bits(pd, (buf == NULL)? NULL : buf + bufLen, 0, chunk_bytes << 3)) {
FREEMEM(buf); FREEMEM(buf);
ASN__DECODE_STARVED; ASN__DECODE_STARVED;
} }
......
...@@ -323,7 +323,7 @@ xer_decode_general(const asn_codec_ctx_t *opt_codec_ctx, ...@@ -323,7 +323,7 @@ xer_decode_general(const asn_codec_ctx_t *opt_codec_ctx,
size_t size_t
xer_whitespace_span(const void *chunk_buf, size_t chunk_size) { xer_whitespace_span(const void *chunk_buf, size_t chunk_size) {
const char *p = (const char *)chunk_buf; const char *p = (const char *)chunk_buf;
const char *pend = p + chunk_size; const char *pend = (p == NULL)? NULL : p + chunk_size;
for(; p < pend; p++) { for(; p < pend; p++) {
switch(*p) { switch(*p) {
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# Test diff(1) capabilities # Test diff(1) capabilities
diff -a . . 2>/dev/null && diffArgs="-a" # Assume text files diff -a . . 2>/dev/null && diffArgs="-a" # Assume text files
diff -u . . 2>/dev/null && diffArgs="$diffArgs -u" # Unified diff output diff -u . . 2>/dev/null && diffArgs="$diffArgs -u" # Unified diff output
diff -w . . 2>/dev/null && diffArgs="$diffArgs -w" # Number of whitespaces not relevant
finalExitCode=0 finalExitCode=0
......
<PDU> <PDU>
<str-m></str-m> <str-m></str-m>
</PDU> </PDU>
<PDU> <PDU>
<str-m></str-m> <str-m></str-m>
</PDU> </PDU>
<PDU> <PDU>
<str-m>ab</str-m> <str-m>ab</str-m>
<singl><opt-z></opt-z></singl> <singl>
<opt-z></opt-z>
</singl>
</PDU> </PDU>
<PDU> <PDU>
<str-m></str-m> <str-m></str-m>
<singl><opt-z>z</opt-z></singl> <singl>
<opt-z>z</opt-z>
</singl>
</PDU> </PDU>
<PDU> <PDU>
<str-m>a</str-m> <str-m>a</str-m>
<singl><opt-z>z</opt-z></singl> <singl>
<opt-z>z</opt-z>
</singl>
</PDU> </PDU>
<PDU> <PDU>
<str-m>some long string spanning multiple bytes</str-m> <str-m>some long string spanning multiple bytes</str-m>
<singl><opt-z>zzz-zzz-zzz-zzz</opt-z></singl> <singl>
<pdu-2> <opt-z>zzz-zzz-zzz-zzz</opt-z>
<ext0>13</ext0> </singl>
</pdu-2> <pdu-2>
<ext0>13</ext0>
</pdu-2>
</PDU> </PDU>
<PDU> <PDU>
<str-m></str-m> <str-m></str-m>
<singl><opt-z></opt-z></singl> <singl>
<pdu-2> <opt-z></opt-z>
<ext0>0</ext0> </singl>
</pdu-2> <pdu-2>
<ext0>0</ext0>
</pdu-2>
</PDU> </PDU>
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