[asterisk-bugs] [JIRA] (ASTERISK-26481) Major issues with FILE and LEN functions

Jonathan Harris (JIRA) noreply at issues.asterisk.org
Fri Oct 21 11:06:01 CDT 2016


    [ https://issues.asterisk.org/jira/browse/ASTERISK-26481?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=232811#comment-232811 ] 

Jonathan Harris edited comment on ASTERISK-26481 at 10/21/16 11:05 AM:
-----------------------------------------------------------------------

Oh damn, sorry. I'm incredibly behind , tired and stressed with this FILE thing, and you're right.

HOWEVER... that first LEN is immaterial, it's the second one which has the correct format, but always puts out 6.

In other words, 
{code}"after file: ---${fileVar}--- LEN ${LEN(${fileVar})}" {code} (<< correct, agreed?) gives (part of loop output shown)

{code}
"Before file: ---1--- len 1 after file: ---1FEc--- LEN 6"
"Before file: ---ABCDE--- len 5 after file: ---ABCD--- LEN 6"
{code}

So above we see that 1 character is now 4 and 5 characters is now 4, both measured as 6. And even if I HAD got the VAR format wrong, "fileVar" is 7 characters now 6 :)

Notice that now the random blob character has changed to 3 extra letters. Which kind of fits in with what you said about " it probably gets some stack garbage from fbuf instead".


was (Author: lardconcepts):
Oh damn, sorry. I'm incredibly behind , tired and stressed with this FILE thing, and you're right.

HOWEVER... that first LEN is immaterial, it's the second one which has the correct format, but always puts out 6.

In other words, "after file: ---${fileVar}--- LEN ${LEN(${fileVar})}"  (<< correct, agreed?) gives (part of loop output shown)

"Before file: ---1--- len 1 after file: ---1FEc--- LEN 6"
"Before file: ---ABCDE--- len 5 after file: ---ABCD--- LEN 6"

So above we see that 1 character is now 4 and 5 characters is now 4, both measured as 6. And even if I HAD got the VAR format wrong, "fileVar" is 7 characters now 6 :)

Notice that now the random blob character has changed to 3 extra letters. Which kind of fits in with what you said about " it probably gets some stack garbage from fbuf instead".

> Major issues with FILE and LEN functions
> ----------------------------------------
>
>                 Key: ASTERISK-26481
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-26481
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Functions/func_cut
>    Affects Versions: 14.0.1
>         Environment: Linux 4.4.0-38-generic #57-Ubuntu SMP Tue Sep 6 15:42:33 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
>            Reporter: Jonathan Harris
>            Assignee: Rusty Newton
>            Severity: Critical
>              Labels: dialplan, file, len, string, variables
>         Attachments: ASTERISK-26481_workaround_fixes_only_half_the_code.patch
>
>
> Something appears wrong with both the FILE and LEN functions
> This bit of dialplan shows some examples: (edited to replace code with links as this trackers messes up code)
> https://gist.githubusercontent.com/lardconcepts/2b6eb371748c4bb2202082a44e5be871/raw/f67b202223cb2ae3b539259b7e047c60cb0c2543/test-dp
> ...produces this output: (tidied only for posting) - this is messed up in so many ways.
> https://gist.githubusercontent.com/lardconcepts/9a8c0b601bccde18f857eb6fe09b73ed/raw/139579ac70034178f7a0a7e9eeb84d33bba462a9/dp-output
> LEN is showing the wrong length. 
> 1 character gets a weird character added.
> 23, and 4  characters OK
> 5 characters loses a character - BUT LOOK! Even though hexdump prints the correct contents and length, have a close look at this: 35|12345|  whereas normally it would have a space before the pipe.
> 6 characters is OK
>  (by the way, Component with id 'functions/func_len' does not exist)



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list