[Users] out of mem during regexp

Bogdan-Andrei Iancu bogdan at voice-system.ro
Fri Jul 21 17:32:39 CEST 2006


Hi Klaus,

the problem should be fixed on CVS - the cause was the invalid regexp: 
nothing (empty string) was matching (due the *) and this nothing was 
found infinitely in the string. This was leading to an infinite loop 
which was allocating private memory for replacing nothing with nothing 
:).....

regards,
bogdan


Klaus Darilion wrote:

> Hi!
>
> Meanwhile I splitted the regexp into several smaller ones nad now it 
> works. But I found an interesting thing when removing blanks from an AVP:
>
> This one works fine:
> avp_subst("$avp(s:pai)/$avp(s:painb)","/[[:blank:]]//g");
>
> This one causes "out of mem":
> avp_subst("$avp(s:pai)/$avp(s:painb)","/[[:blank:]]*//g");
>                                                    ^
>
> 07:17:46 server2 /usr/sbin/openser[6565]: subst_run: running. r=0
> 07:17:46 server2 /usr/sbin/openser[6565]: subst_run: matched (0, 0): []
> 07:18:12 server2 /usr/sbin/openser[6565]: subst_run: running. r=0
> 07:18:12 server2 /usr/sbin/openser[6565]: subst_run: matched (0, 0): []
> 07:18:12 server2 /usr/sbin/openser[6565]: subst_run: running. r=0
> 07:18:12 server2 /usr/sbin/openser[6565]: subst_run: matched (0, 0): []
> 07:18:12 server2 /usr/sbin/openser[6565]: ERROR: replace_build: out of 
> mem (rpl)
> 07:18:12 server2 /usr/sbin/openser[6565]: subst_str: no match
> 07:18:12 server2 /usr/sbin/openser[6565]: avpops:ops_subst: subst to 0 
> avps
>
>
> regards
> klaus
>
>
> Klaus Darilion wrote:
>
>> Norman Brandinger wrote:
>>
>>> Hi Klaus,
>>>
>>> Below is a little test I put together to try to help you out:
>>>
>>> avp_write("<tel:+43108>", "$avp(s:pai)");
>>> avp_subst("$avp(s:pai)/$avp(s:cli)","/<tel\:(.*)>/\1/");
>>> xlog("L_NOTICE", "pai=$avp(s:pai) cli=$avp(s:cli)\n");
>>>
>>> This is the result:
>>>
>>> pai=<tel:+43108> cli=+43108
>>
>>
>> Hi Norman. Yes, you are right. I simply had a wrong regular 
>> expression. But now I have another problem:
>>
>> Input: $avp(s:pai) = '<   tel:+43103   >'
>> (the part within '')
>>
>> avp_subst("$avp(s:pai)/$avp(s:paias)","/.*<[[:blank:]]*(.*?)[[:blank:]]*>.*/\1/") 
>>
>>
>> Output: $avp(s:paias) = 'tel:+43103   '
>>
>> Thus, the leading whitespace is removed, but not the trailing one, 
>> but I can't find an error in my regular expression. Maybe some regexp 
>> experts out there?
>>
>> thanks
>> klaus
>>
>>>
>>> Regards,
>>> Norm
>>>
>>> Klaus Darilion wrote:
>>>
>>>> Hi!
>>>>
>>>> I have problems with avp_subst:
>>>>
>>>> I have $avp(s:pai) with the value <tel:+43108> (the < and > belongs 
>>>> to the AVP)
>>>>
>>>> Then I want to extract the number into $avp(s:cli):
>>>>
>>>> avp_subst("$avp(s:pai)/$avp(s:cli)","/tel:(.*)/\1/")
>>>>
>>>> The result is <+43108>
>>>>
>>>> Can someone explain me why the leading < belongs to the result? 
>>>> Shouldn't it be removed?
>>>>
>>>> thanks
>>>> klaus
>>>





More information about the Users mailing list