added stack control to PER


git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@1022 59561ff5-6e30-0410-9f3c-9617f08c8826
diff --git a/skeletons/constr_SEQUENCE.c b/skeletons/constr_SEQUENCE.c
index decc56d..e4a5b08 100644
--- a/skeletons/constr_SEQUENCE.c
+++ b/skeletons/constr_SEQUENCE.c
@@ -703,7 +703,8 @@
 		}
 
 		tcv = xer_check_tag(buf_ptr, ch_size, xml_tag);
-		ASN_DEBUG("XER/SEQUENCE: tcv = %d, ph=%d", tcv, ctx->phase);
+		ASN_DEBUG("XER/SEQUENCE: tcv = %d, ph=%d [%s]",
+			tcv, ctx->phase, xml_tag);
 
 		/* Skip the extensions section */
 		if(ctx->phase == 3) {
@@ -829,7 +830,13 @@
 			break;
 		}
 
-		ASN_DEBUG("Unexpected XML tag in SEQUENCE");
+		ASN_DEBUG("Unexpected XML tag in SEQUENCE [%c%c%c%c%c%c]",
+			size>0?((const char *)buf_ptr)[0]:'.',
+			size>1?((const char *)buf_ptr)[1]:'.',
+			size>2?((const char *)buf_ptr)[2]:'.',
+			size>3?((const char *)buf_ptr)[3]:'.',
+			size>4?((const char *)buf_ptr)[4]:'.',
+			size>5?((const char *)buf_ptr)[5]:'.');
 		break;
 	}
 
@@ -1028,6 +1035,9 @@
 
 	(void)constraints;
 
+	if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx))
+		_ASN_DECODE_FAILED;
+
 	if(!st) {
 		st = *sptr = CALLOC(1, specs->struct_size);
 		if(!st) _ASN_DECODE_FAILED;