Commit 3d6fcfec authored by Lev Walkin's avatar Lev Walkin

more robust pre-allocation; credits to Yuriy Olkhovyy

parent 1d44923c
...@@ -339,6 +339,9 @@ INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chun ...@@ -339,6 +339,9 @@ INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chun
ASN_DEBUG("INTEGER body %ld 0x%2x..0x%2x", ASN_DEBUG("INTEGER body %ld 0x%2x..0x%2x",
(long)chunk_size, *lstart, lstop[-1]); (long)chunk_size, *lstart, lstop[-1]);
if(INTEGER_st_prealloc(st, (chunk_size/3) + 1))
return XPBD_SYSTEM_FAILURE;
/* /*
* We may have received a tag here. It will be processed inline. * We may have received a tag here. It will be processed inline.
* Use strtoul()-like code and serialize the result. * Use strtoul()-like code and serialize the result.
...@@ -447,8 +450,6 @@ INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chun ...@@ -447,8 +450,6 @@ INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chun
* places as a decimal value. * places as a decimal value.
* Switch decoding mode. */ * Switch decoding mode. */
ASN_DEBUG("INTEGER re-evaluate as hex form"); ASN_DEBUG("INTEGER re-evaluate as hex form");
if(INTEGER_st_prealloc(st, (chunk_size/3) + 1))
return XPBD_SYSTEM_FAILURE;
state = ST_SKIPSPHEX; state = ST_SKIPSPHEX;
lp = lstart - 1; lp = lstart - 1;
continue; continue;
...@@ -476,8 +477,6 @@ INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chun ...@@ -476,8 +477,6 @@ INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chun
continue; continue;
case ST_DIGITS: case ST_DIGITS:
ASN_DEBUG("INTEGER re-evaluate as hex form"); ASN_DEBUG("INTEGER re-evaluate as hex form");
if(INTEGER_st_prealloc(st, (chunk_size/3) + 1))
return XPBD_SYSTEM_FAILURE;
state = ST_SKIPSPHEX; state = ST_SKIPSPHEX;
lp = lstart - 1; lp = lstart - 1;
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment