From: Andre Noll Date: Sat, 28 Mar 2009 18:13:23 +0000 (+0100) Subject: fecdec: Return an error on zero size slices. X-Git-Tag: v0.3.4~20 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=f97bcd9d55344c8f1232470eac01974cd53a9d7f;p=paraslash.git fecdec: Return an error on zero size slices. --- diff --git a/error.h b/error.h index 7de3f436..94a41202 100644 --- a/error.h +++ b/error.h @@ -49,7 +49,7 @@ extern const char **para_errlist[]; #define FECDEC_FILTER_ERRORS \ PARA_ERROR(BAD_FEC_HEADER, "invalid fec header"), \ - PARA_ERROR(BAD_SLICE_SIZE, "slice size too large"), \ + PARA_ERROR(BAD_SLICE_SIZE, "slice size zero or too large"), \ PARA_ERROR(BAD_SLICE_NUM, "invalid slice number"), \ PARA_ERROR(FECDEC_OVERRUN, "fecdec output buffer overrun"), \ PARA_ERROR(FECDEC_EOF, "received eof packet"), \ diff --git a/fecdec_filter.c b/fecdec_filter.c index 794add49..a7d1875c 100644 --- a/fecdec_filter.c +++ b/fecdec_filter.c @@ -358,7 +358,7 @@ static ssize_t fecdec(char *buf, size_t len, struct filter_node *fn) ret = read_fec_header(buf, len, &h); if (ret <= 0) return ret; - if (h.slice_bytes > fn->bufsize) + if (!h.slice_bytes || h.slice_bytes > fn->bufsize) return -E_BAD_SLICE_SIZE; if (h.slice_num > h.slices_per_group) return -E_BAD_SLICE_NUM;