# HG changeset patch # User reimar # Date 1114939411 0 # Node ID 0313ef8b0730cceca4a619010c58d98d8a9b891c # Parent b00b16a1ef05eb1ef31292ebf5395a58143dc9eb Prevent segfault when filter chain is empty (e.g. because all filters returned AF_DETACH). Fixes bugzilla bug #293. diff -r b00b16a1ef05 -r 0313ef8b0730 libaf/af.c --- 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));