helpGNU Libtasn1 - Support: sr #108157, Error in parsing INTEGER...

 
 

sr #108157: Error in parsing INTEGER constraints

Submitted by:  None
Submitted on:  Wed 10 Oct 2012 12:43:41 PM UTC  
Votes:  50  
 
Category: NonePriority: 5 - Normal
Severity: 4 - ImportantStatus: None
Privacy: PublicAssigned to: None
Originator Email: -unavailable-Open/Closed: Open
Operating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 10 Oct 2012 12:43:41 PM UTC, original submission:

Concider the following application which tries to load an ans1 spec a bunch of times(loading multiple times better shows the effect of the bug):

#include <libtasn1.h>
#include <assert.h>

int main (int argc, char *argv[])
{
for(int i = 0; i < 2000000; i++)
{
ASN1_TYPE tree = ASN1_TYPE_EMPTY;
assert(asn1_parser2tree("<file containing asn1>", &tree, errorDescription) == ASN1_SUCCESS);
assert(asn1_delete_structure(&tree) == ASN1_SUCCESS);
}

return 0;
}

Run it with both of the follwing specs and watch the memory usage:

-----------------------------------------------------------

Spec {} DEFINITIONS EXPLICIT TAGS ::= BEGIN

SpecNoConstraints ::= SEQUENCE {
first-field [0] INTEGER,
second-field [1] INTEGER,
third-field [2] INTEGER,
fourth-field [3] INTEGER,
fifth-field [4] INTEGER
}

END

-----------------------------------------------------------

Spec {} DEFINITIONS EXPLICIT TAGS ::= BEGIN

SpecNoConstraints ::= SEQUENCE {
first-field INTEGER (1),
second-field INTEGER (1),
third-field INTEGER (1),
fourth-field INTEGER (1),
fifth-field INTEGER (1)
}

END

-----------------------------------------------------------

The first spec where the INTEGER fields have no constraints will behave as expected, the second one on the other hand claims loads of memory that is never returned to the OS.
My lex/yacc is no good but the parser seems to claim an extra asn_node for the constraint that is unnecessary (ASN1.y:206 in 2.14)

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by weary (Voted in favor of this item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 50 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 11 Oct 2012 09:09:22 AM UTCwearyCarbon-Copy-=>Added weary

    Back to the top


    Powered by Savane 3.1-cleanup