jolly has uploaded this change for review.
Generate ASN.1 code with recent master branch of asn1c
Commit-Hash of asn1c using from now on:
2f7f40dab3973f707d66f4a67cae0cc1bc8e62b5
Related: SYS#8101
Change-Id: I1ac4cf8980af501bb119208213242468ee4f3c06
---
M src/ipa/libasn/asn_internal.c
M src/ipa/libasn/asn_internal.h
M src/ipa/libasn/constr_CHOICE.c
3 files changed, 32 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/onomondo-ipa refs/changes/21/43021/1
diff --git a/src/ipa/libasn/asn_internal.c b/src/ipa/libasn/asn_internal.c
index 91e537c..3b8a2d5 100644
--- a/src/ipa/libasn/asn_internal.c
+++ b/src/ipa/libasn/asn_internal.c
@@ -1,5 +1,13 @@
#include <asn_internal.h>
+#ifdef ASN__DEBUG_INDENT_NEEDS_DEFINITION
+/*
+ * The single definition of the debugging indentation level,
+ * shared by all units which refer to it via "extern" in asn_internal.h.
+ */
+int asn_debug_indent;
+#endif
+
ssize_t
asn__format_to_callback(int (*cb)(const void *, size_t, void *key), void *key,
const char *fmt, ...) {
diff --git a/src/ipa/libasn/asn_internal.h b/src/ipa/libasn/asn_internal.h
index 76dac64..0dffd35 100644
--- a/src/ipa/libasn/asn_internal.h
+++ b/src/ipa/libasn/asn_internal.h
@@ -21,7 +21,7 @@
#endif
/* Environment version might be used to avoid running with the old library */
-#define ASN1C_ENVIRONMENT_VERSION 923 /* Compile-time version */
+#define ASN1C_ENVIRONMENT_VERSION 929 /* Compile-time version */
int get_asn1c_environment_version(void); /* Run-time version */
#include <onomondo/ipa/mem.h>
@@ -51,7 +51,8 @@
#else /* !ASN_THREAD_SAFE */
#undef ASN_DEBUG_INDENT_ADD
#undef asn_debug_indent
-int asn_debug_indent;
+extern int asn_debug_indent; /* A single definition is in asn_internal.c */
+#define ASN__DEBUG_INDENT_NEEDS_DEFINITION 1
#define ASN_DEBUG_INDENT_ADD(i) do { asn_debug_indent += i; } while(0)
#endif /* ASN_THREAD_SAFE */
#define ASN_DEBUG(fmt, args...) do { \
@@ -126,8 +127,25 @@
/*
* Check stack against overflow, if limit is set.
+ * ASan inflates stack frames by ~30x (red zones per variable), making the
+ * distance-based check fire false positives at normal call depth. Disable
+ * when building under ASan — ASan itself catches real stack overflows.
+ * GCC and MSVC define __SANITIZE_ADDRESS__; Clang only exposes
+ * __has_feature(address_sanitizer).
*/
+#if defined(__SANITIZE_ADDRESS__)
+#define ASN__ASAN_ENABLED 1
+#elif defined(__has_feature)
+#if __has_feature(address_sanitizer)
+#define ASN__ASAN_ENABLED 1
+#endif
+#endif
+
+#ifdef ASN__ASAN_ENABLED
+#define ASN__DEFAULT_STACK_MAX (0)
+#else
#define ASN__DEFAULT_STACK_MAX (30000)
+#endif
static int CC_NOTUSED
ASN__STACK_OVERFLOW_CHECK(const asn_codec_ctx_t *ctx) {
if(ctx && ctx->max_stack_size) {
diff --git a/src/ipa/libasn/constr_CHOICE.c b/src/ipa/libasn/constr_CHOICE.c
index 628979e..6d26dd1 100644
--- a/src/ipa/libasn/constr_CHOICE.c
+++ b/src/ipa/libasn/constr_CHOICE.c
@@ -340,6 +340,10 @@
ADVANCE(2);
ctx->left++;
continue;
+ } else {
+ ASN_DEBUG("Unexpected continuation in %s",
+ td->name);
+ RETURN(RC_FAIL);
}
} else {
ASN_DEBUG("Unexpected continuation in %s",
To view, visit change 43021. To unsubscribe, or for help writing mail filters, visit settings.