[asterisk-bugs] [JIRA] (ASTERISK-23739) Segfault forwarding voicemail with ODBC storage enabled and realtime voicemail_data is used

Michael L. Young (JIRA) noreply at issues.asterisk.org
Wed May 14 12:40:45 CDT 2014


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

Michael L. Young edited comment on ASTERISK-23739 at 5/14/14 12:40 PM:
-----------------------------------------------------------------------

Stas,

Thank you for that detailed information.  There is always something new to learn.  I have used ODBC for voice-mail storage for many years and fixed bugs here and there in app_voicemail.c.  I never noticed the ability to store, basically, the .txt information in the database.  It doesn't seem to be documented very well.

In looking at what this feature does and trying to understand its purpose, there is a bug here but I am not sure your patch is the correct solution.  Essentially, your patch turns off storing this data about a voice-mail message in the database if you have ODBC storage enabled and attempt to copy a file to another location.

What appears to be the problem is that when performing a cleanup of the mailbox after a user is done listening to their voice-mail, there is no cleanup being done to this voicemail_data (in your case voicemail_messages) table.  Therefore, when a new message comes in, it is unable to store the proper filename for that new message because filename is a key field and duplicate entries are not allowed in the database table.  When this is the case, the temporary filename of the file is being saved in the database table.  When copy_plain_file() is called, it is unable to find any information about that file being copied in the voicemail_data table which then creates the issue that you are having.

In summary, I see two issues that need to be solved.
* Properly remove the voice-mail record or update the filename field in the database table when a recording is deleted or moved to another folder during the closing of the mailbox
* Properly handle the condition when no data is returned from the database table based on the given filename


was (Author: elguero):
Stas,

Thank you for that detailed information.  There is always something new to learn.  I have used ODBC for voice-mail storage for many years and fixed bugs here and there in app_voicemail.c.  I never noticed the ability to store, basically, the .txt information in the database.  It doesn't seem to be documented very well.

In looking at what this feature does and trying to understand its purpose, there is a bug here but I am not sure your patch is the correct solution.  Essentially, your patch turns off storing this data about a voice-mail message in the database if you have ODBC storage enabled.

What appears to be the problem is that when performing a cleanup of the mailbox after a user is done listening to their voice-mail, there is no cleanup being done to this voicemail_data (in your case voicemail_messages) table.  Therefore, when a new message comes in, it is unable to store the proper filename for that new message because filename is a key field and duplicate entries are not allowed in the database table.  When this is the case, the temporary filename of the file is being saved in the database table.  When copy_plain_file() is called, it is unable to find any information about that file being copied in the voicemail_data table which then creates the issue that you are having.

In summary, I see two issues that need to be solved.
* Properly remove the voice-mail record or update the filename field in the database table when a recording is deleted or moved to another folder during the closing of the mailbox
* Properly handle the condition when no data is returned from the database table based on the given filename

> Segfault forwarding voicemail with ODBC storage enabled and realtime voicemail_data is used
> -------------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-23739
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-23739
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Applications/app_voicemail, Applications/app_voicemail/ODBC
>    Affects Versions: 11.9.0
>            Reporter: Stas Kobzar
>            Assignee: Stas Kobzar
>            Severity: Minor
>         Attachments: asterisk_10.patch, asterisk_11.patch, asterisk_12.patch, asterisk_1.8.patch, backtrace-issue-23739.txt, full-issue-23739, valgrind-issue-23739.txt
>
>
> Hello,
> Asterisk is crashing with with segfaul on VoiceMail application when using option 8 (forward message to another voicemail box). This happens when Asterisk is compiled with voicemail ODBC storage and voicemail_data realtime is enabled in extconfig.conf.
> To reproduce:
> - Asterisk configured with voicemail storage ODBC
> - realtime voicemail_data family enabled
> - Call to Voicemail and use option 8 to forward new voicemail. When prompted forward options press "2". Asterisk will crash with segfault. 
> This is happens because in function _copy_plain_file_ Asterisk is trying to load a voicemail message from realtime voicemail_data family:
> {code}
> if (ast_check_realtime("voicemail_data")) {
>   var = ast_load_realtime("voicemail_data", "filename", frompath, SENTINEL);
>   for (tmp = var; tmp; tmp = tmp->next) {
>     if (!strcasecmp(tmp->name, "origmailbox")) {
>       origmailbox = tmp->value;
> }
>   ...
> {code}
> If the record does not exists, following assignment will crash Asterisk:
> {code}origmailbox = tmp->value;{code}
> Patch attached.
> Thank you,
> Stas Kobzar



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



More information about the asterisk-bugs mailing list