help-libtasn1
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Checking errors in the asn1_order functions


From: Kurt Roeckx
Subject: Re: Checking errors in the asn1_order functions
Date: Sun, 20 Apr 2014 15:31:46 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

On Sun, Apr 20, 2014 at 11:29:28AM +0200, Kurt Roeckx wrote:
> 
> I don't understand enough about the code to know if this is all
> normal or not.

So, the whole part of the function looks like:
              len2 = _asn1_strtol (p->value, NULL, 10);
              _asn1_set_value (p, NULL, 0);
              if ((type_field (p->type) == ASN1_ETYPE_SET) && (max_len >= 0))
                _asn1_ordering_set (der + len2, max_len - len2, p);
              asn1_length_der (counter - len2, temp, &len3);
              max_len -= len3;
              if (max_len >= 0)
                {
                  memmove (der + len2 + len3, der + len2, counter - len2);
                  memcpy (der + len2, temp, len3);
                }
              counter += len3;
              move = RIGHT;

At that point we have:
(gdb) p counter
$1 = 148
(gdb) p max_len
$2 = 3
(gdb) p len2
$3 = 2

And afterwards we're going to insert someting of len3:
(gdb) p len3
$4 = 2

So there would still be 1 byte left that we'll have a problem with
the next thing we try to add (the _asn1_complete_explicit_tag()).

What I don't get is that it's trying to order from der + len2 over
max_len - len2 and then moves der + len2 over counter - len2.

So I assumed the problem was that it needed to:
-                _asn1_ordering_set (der + len2, max_len - len2, p);
+                _asn1_ordering_set (der + len2, counter - len2, p);

But then I end up with:
Error at line 661
ERROR in 302:
  Action 6 -  - (null) - 19
  Error expected: MEM_ERROR
  Error detected: VALUE_NOT_FOUND


I still believe that it needs counter - len2 there at this point.


Kurt




reply via email to

[Prev in Thread] Current Thread [Next in Thread]