mirror of https://gerrit.osmocom.org/asn1c
more robust pre-allocation; credits to Yuriy Olkhovyy
This commit is contained in:
parent
1d44923c50
commit
3d6fcfecd7
|
@ -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",
|
||||
(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.
|
||||
* 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
|
|||
* places as a decimal value.
|
||||
* Switch decoding mode. */
|
||||
ASN_DEBUG("INTEGER re-evaluate as hex form");
|
||||
if(INTEGER_st_prealloc(st, (chunk_size/3) + 1))
|
||||
return XPBD_SYSTEM_FAILURE;
|
||||
state = ST_SKIPSPHEX;
|
||||
lp = lstart - 1;
|
||||
continue;
|
||||
|
@ -476,8 +477,6 @@ INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chun
|
|||
continue;
|
||||
case ST_DIGITS:
|
||||
ASN_DEBUG("INTEGER re-evaluate as hex form");
|
||||
if(INTEGER_st_prealloc(st, (chunk_size/3) + 1))
|
||||
return XPBD_SYSTEM_FAILURE;
|
||||
state = ST_SKIPSPHEX;
|
||||
lp = lstart - 1;
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue