]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
vss: Reset afhi.chunks_total on eof.
authorAndre Noll <maan@tuebingen.mpg.de>
Sat, 19 Mar 2022 22:48:18 +0000 (23:48 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 27 Mar 2022 18:05:27 +0000 (20:05 +0200)
Without this, the server can be crashed by running

para_client nomore # set the nomore flag
# wait for eof
para_client jmp 50 # set the repos flag, clear the next flag
para_client play # boom

The problem is that the command handler of the jmp command checks
afhi.chunks_total to determine if some audio file is currently
open. Since vss_eof() did not reset chunks_total, the command handler
wrongly believes that there is an open audio file, sets the repos
flag and clears the next flag. When streaming is resumed later, the
virtual streaming system attempts to access the chunk table which
was freed earlier in vss_eof().

vss.c

diff --git a/vss.c b/vss.c
index 9969a150ee63291e182f058664af9178eabf77f3..235219c1148aac2412b1b41879bf045d0b571af8 100644 (file)
--- a/vss.c
+++ b/vss.c
@@ -845,7 +845,6 @@ static void vss_compute_timeout(struct sched *s, struct vss_task *vsst)
 
 static void vss_eof(struct vss_task *vsst)
 {
-
        if (!vsst->map)
                return;
        if (mmd->new_vss_status_flags & VSS_NOMORE)
@@ -856,8 +855,8 @@ static void vss_eof(struct vss_task *vsst)
        para_munmap(vsst->map, vsst->mapsize);
        vsst->map = NULL;
        mmd->chunks_sent = 0;
-       //mmd->offset = 0;
        mmd->afd.afhi.seconds_total = 0;
+       mmd->afd.afhi.chunks_total = 0;
        mmd->afd.afhi.chunk_tv.tv_sec = 0;
        mmd->afd.afhi.chunk_tv.tv_usec = 0;
        free(mmd->afd.afhi.chunk_table);