[asterisk-dev] [Code Review] Fix for invalid memory access in adding extension to pattern match tree

mjordan reviewboard at asterisk.org
Fri Oct 14 15:07:02 CDT 2011


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

Review request for Asterisk Developers and kmoore.


Summary
-------

A number of subtle errors were detected through ASTERISK-18135.

When an extension is removed from a context, its entry in the pattern matching tree is not deleted.  Instead, the extension is marked as deleted.  When an extension is removed (marked as deleted) and readded, if that extension is a prefix of another extension, several log messages did not check to see if the extension was deleted before printing out the extension.  This would cause an invalid read access.

In addition, if the extension was already in the tree (but deleted) and the pattern was at an end, the findonly flag was not honored and the extension would be erroneously undeleted.

Finally, during testing, it was discovered that an IAX2 peer could be unregistered via the CLI, while at the same time it could be scheduled for unregistration.  The unregistration method now checks to see if something else (such as the CLI) has already unregistered the IAX2 peer before it performs the unregistration.


This addresses bug ASTERISK-18135.
    https://issues.asterisk.org/jira/browse/ASTERISK-18135


Diffs
-----

  /branches/1.8/channels/chan_iax2.c 340930 
  /branches/1.8/main/pbx.c 340930 

Diff: https://reviewboard.asterisk.org/r/1526/diff


Testing
-------

Performed the scenario described in ASTERISK-18135 under valgrind; this patch did indeed resolve the memory access issues.

Also tested with SIP peers; ran under the Asterisk test suite without issues.


Thanks,

mjordan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20111014/d9778ebf/attachment-0001.htm>


More information about the asterisk-dev mailing list