aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2009-12-01 21:29:31 +0000
committerjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2009-12-01 21:29:31 +0000
commit4f8ac3ac1926587df081bf675ded083e4bb7bc99 (patch)
tree8c88392eea6fa9dbd33233ec9eaa44e04db4b174 /main
parent29c20ce9986a2ef21f2a27a4af35b151f4adcb8b (diff)
Fix crash with invalid frame data
The crash was happening as a result of a frame containing an invalid data pointer, but was set with data length of zero. The few times the issue was reproduced it _seemed_ that the frame was queued properly, that is the data pointer was set to NULL. I never could reproduce the crash so as a last resort the crash has been fixed, but a check in __ast_read has been added to give as much information about the source of problematic frames in the future. (closes issue #16058) Reported by: atis git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@231911 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/channel.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/main/channel.c b/main/channel.c
index 61a5a3608..dfd1062ac 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -2513,6 +2513,17 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
ast_frame_dump(chan->name, f, "<<");
chan->fin = FRAMECOUNT_INC(chan->fin);
+ if (f && f->datalen == 0 && f->data) {
+ /* fix invalid pointer */
+ f->data = NULL;
+#ifdef AST_DEVMODE
+ ast_log(LOG_ERROR, "Found frame with src '%s' with datalen zero, but non-null data pointer!\n", f->src);
+ ast_frame_dump(chan->name, f, "<<");
+#else
+ ast_debug(3, "Found frame with src '%s' on channel '%s' with datalen zero, but non-null data pointer!\n", f->src, chan->name);
+#endif
+ }
+
done:
ast_channel_unlock(chan);
return f;