]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - aft.c
aft: Avoid invalid read.
[paraslash.git] / aft.c
diff --git a/aft.c b/aft.c
index b4adbacf6e2a93b17c25f11bacb9845c47538c53..e370eaad80cdfadc9dbd62b357442e200945934e 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -407,7 +407,7 @@ static void load_chunk_table(struct afh_info *afhi, const struct osl_object *ct)
        int i;
        size_t sz;
 
-       if (!ct->data || ct->size < 4) {
+       if (!ct->data || ct->size < 4 * (afhi->chunks_total + 1)) {
                afhi->chunk_table = NULL;
                return;
        }
@@ -2534,10 +2534,12 @@ static int aft_open(const char *dir)
                PARA_NOTICE_LOG("current audio file hash lookup: success\n");
                return 1;
        }
-       PARA_NOTICE_LOG("failed to open audio file table\n");
        audio_file_table = NULL;
-       if (ret == -OSL_ERRNO_TO_PARA_ERROR(E_OSL_NOENT))
+       if (ret == -OSL_ERRNO_TO_PARA_ERROR(E_OSL_NOENT)) {
+               PARA_WARNING_LOG("no audio file table\n");
                return 1;
+       }
+       PARA_NOTICE_LOG("failed to open audio file table\n");
        return ret;
 }