fecdec: Return an error on zero size slices.
authorAndre Noll <maan@systemlinux.org>
Sat, 28 Mar 2009 18:13:23 +0000 (19:13 +0100)
committerAndre Noll <maan@systemlinux.org>
Sat, 28 Mar 2009 18:13:23 +0000 (19:13 +0100)
error.h
fecdec_filter.c

diff --git a/error.h b/error.h
index 7de3f43..94a4120 100644 (file)
--- 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"), \
index 794add4..a7d1875 100644 (file)
@@ -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;