changeset 15312:0313ef8b0730

Prevent segfault when filter chain is empty (e.g. because all filters returned AF_DETACH). Fixes bugzilla bug #293.
author reimar
date Sun, 01 May 2005 09:23:31 +0000
parents b00b16a1ef05
children ff379596f099
files libaf/af.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libaf/af.c	Sun May 01 09:02:25 2005 +0000
+++ b/libaf/af.c	Sun May 01 09:23:31 2005 +0000
@@ -368,6 +368,11 @@
   if(AF_OK != af_reinit(s,s->first))
     return -1;
 
+  // make sure the chain is not empty and valid (e.g. because of AF_DETACH)
+  if (!s->first)
+    if (!af_append(s,s->first,"dummy") || AF_OK != af_reinit(s,s->first))
+      return -1;
+
   // If force_output isn't set do not compensate for output format
   if(!force_output){
     memcpy(&s->output, s->last->data, sizeof(af_data_t));