fix(linker): prevent stack overflow from over-eager recursion marking#96
Merged
fix(linker): prevent stack overflow from over-eager recursion marking#96
Conversation
Contributor
|
Unfortunately, I am still seeing a stack overflow with v0.8.1. If desired, I am happy to send some ASN.1 that can reproduce it. |
Member
Author
|
@DavidLeeds please do, the example from #95 compiles fine. |
Contributor
|
@6d7a Here is a snippet that reproduces it. flowchart BT
VariableSpecification --> TypeSpecification
TypeSpecification --> TypeDescription
TypeDescription --> TypeSpecification
ISO-9506-MMS-Snippet
DEFINITIONS ::= BEGIN
maxIdentifier INTEGER ::= 32
Integer8 ::= INTEGER (-128..127)
Integer16 ::= INTEGER (-32768..32767)
Integer32 ::= INTEGER (-2147483648..2147483647)
Unsigned8 ::= INTEGER (0..127)
Unsigned16 ::= INTEGER (0..32767)
Unsigned32 ::= INTEGER (0..2147483647)
FloatingPoint ::= OCTET STRING
MMSString ::= VisibleString
MMS255String ::= VisibleString (SIZE (1..255))
TimeOfDay ::= OCTET STRING (SIZE (4 | 6))
Identifier ::= VisibleString (SIZE (1..maxIdentifier))
Address ::= CHOICE {
numericAddress [0] IMPLICIT Unsigned32,
symbolicAddress [1] MMSString,
unconstrainedAddress [2] IMPLICIT OCTET STRING
}
ObjectName ::= CHOICE {
vmd-specific [0] IMPLICIT Identifier,
domain-specific [1] IMPLICIT SEQUENCE {
domainID Identifier,
itemID Identifier
},
aa-specific [2] IMPLICIT Identifier
}
TypeDescription ::= CHOICE {
array [1] IMPLICIT SEQUENCE {
packed [0] IMPLICIT BOOLEAN DEFAULT FALSE,
numberOfElements [1] IMPLICIT Unsigned32,
elementType [2] TypeSpecification
},
structure [2] IMPLICIT SEQUENCE {
packed [0] IMPLICIT BOOLEAN DEFAULT FALSE,
components [1] IMPLICIT SEQUENCE OF SEQUENCE {
componentName [0] IMPLICIT Identifier OPTIONAL,
componentType [1] TypeSpecification
}
},
boolean [3] IMPLICIT NULL,
bit-string [4] IMPLICIT Integer32,
integer [5] IMPLICIT Unsigned8,
unsigned [6] IMPLICIT Unsigned8,
floating-point [7] IMPLICIT SEQUENCE {
format-width Unsigned8,
exponent-width Unsigned8
},
octet-string [9] IMPLICIT Integer32,
visible-string [10] IMPLICIT Integer32,
generalized-time [11] IMPLICIT NULL,
binary-time [12] IMPLICIT BOOLEAN,
bcd [13] IMPLICIT Unsigned8,
objId [15] IMPLICIT NULL,
...,
mMSString [16] Integer32
}
TypeSpecification ::= CHOICE {
typeName [0] ObjectName,
typeDescription TypeDescription
}
VariableSpecification ::= CHOICE {
name [0] ObjectName,
address [1] Address,
variableDescription [2] IMPLICIT SEQUENCE {
address Address,
typeSpecification TypeSpecification
}
}
ENDWe see endless recursion in the stack trace: |
Member
Author
|
Great! Thank you. I'll have a look. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #95
Stops recursion detection at options and sequence members that are already marked
is_recursive. Options and members that are marked recursive will beBoxed. TheBoxconstitutes a recursion breaker, so we do not have to check its children for recursion.