[asterisk-dev] [Code Review] 3985: realtime configuration: anything that goes through ast_destroy_realtime crashes if only a single key/value pair is used.

Jonathan Rose reviewboard at asterisk.org
Wed Sep 10 15:50:12 CDT 2014



> On Sept. 10, 2014, 6:33 a.m., Joshua Colp wrote:
> > /branches/12/main/config.c, lines 3147-3149
> > <https://reviewboard.asterisk.org/r/3985/diff/1/?file=67294#file67294line3147>
> >
> >     It's still possible for this to occur under extreme circumstances (out of memory).
> 
> Joshua Colp wrote:
>     To clarify more: In extreme cases you don't want this to actually execute as it may delete stuff it shouldn't.

Oi, that certainly makes a mess of things.  I guess now I need to add the ability for realtime_arguments_to_fields to be able to indicate that it bailed on an error as opposed to just returning NULL.


- Jonathan


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3985/#review13269
-----------------------------------------------------------


On Sept. 9, 2014, 12:04 p.m., Jonathan Rose wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3985/
> -----------------------------------------------------------
> 
> (Updated Sept. 9, 2014, 12:04 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Bugs: ASTERISK-24231
>     https://issues.asterisk.org/jira/browse/ASTERISK-24231
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> Attempting to use the following CLI command would cause a crash (regardless of whether a realtime database were in any way configured)
> 
> realtime destroy (any table) field1 value1
> 
> This was due to attempting to create a variable list from a NULL name since we sent an empty va list to a function that creates variable lists from va lists.
> 
> I've changed that function to be tolerant of empty va lists and I've changed the ast_realtime_destroy function to go ahead and call the realtime engine destroy functions even if the variable list that it gets back from that function is NULL.
> 
> 
> Diffs
> -----
> 
>   /branches/12/main/config.c 422869 
> 
> Diff: https://reviewboard.asterisk.org/r/3985/diff/
> 
> 
> Testing
> -------
> 
> I tested the changes against both a postgres database connected via res_config_pgsql and a mysql database connected via res_config_odbc. Of the two, res_config_odbc appeared to be the more likely source of trouble since it might use the variable list for something other than just iteration. It appears to set a string field to the variable list for whatever reason... in any event, both appeared to work fine and I didn't notice anything out of the ordinary happening due to deallocation or anything.
> 
> I went ahead and checked all the other realtime engines to make sure their destroy functions looked like they would be compatible with NULL variable lists as well and they all checked out... they just add entries by iterating along the list and if it's NULL it just won't enter the loop in each case.
> 
> 
> Thanks,
> 
> Jonathan Rose
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140910/5a99c934/attachment.html>


More information about the asterisk-dev mailing list