summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriel Peixoto <gabrielrcp@gmail.com>2013-09-08 02:24:30 -0300
committerwm4 <wm4@nowhere>2013-09-08 07:44:08 +0200
commit856c58aa9c47da9a1c42385d2923ebe4735e3a90 (patch)
treef663c07cde557e16ea69b249d12eeaf173b5ab72
parent35fd083828a57eb7ae995bd081dad88a8d64f75d (diff)
downloadmpv-856c58aa9c47da9a1c42385d2923ebe4735e3a90.tar.bz2
mpv-856c58aa9c47da9a1c42385d2923ebe4735e3a90.tar.xz
find_subfiles: fix off-by-1 error
This could lead to a segfault, fixes #219 Signed-off-by: Gabriel Peixoto <gabrielrcp@gmail.com> Signed-off-by: wm4 <wm4@nowhere>
-rw-r--r--sub/find_subfiles.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sub/find_subfiles.c b/sub/find_subfiles.c
index f272e84e73..691c0148d3 100644
--- a/sub/find_subfiles.c
+++ b/sub/find_subfiles.c
@@ -212,7 +212,7 @@ static void filter_subidx(struct subfn **slist, int *nsub)
(*slist)[n].priority = -1;
}
}
- for (int n = *nsub; n >= 0; n--) {
+ for (int n = *nsub - 1; n >= 0; n--) {
if ((*slist)[n].priority < 0)
MP_TARRAY_REMOVE_AT(*slist, *nsub, n);
}