fix pdftex segfault on pdfmatch invocations
Norbert Preining
7 years ago
0 | fix a segfault in pdftex | |
1 | reported by David Carlisle on tex-live | |
2 | http://tug.org/pipermail/tex-live/2016-June/038664.html | |
3 | proposed fix by Akira Kakuto | |
4 | http://tug.org/pipermail/tex-live/2016-June/038666.html | |
5 | originally on tex.sx | |
6 | http://chat.stackexchange.com/transcript/message/30145736 | |
7 | --- | |
8 | texk/web2c/pdftexdir/utils.c | 3 ++- | |
9 | 1 file changed, 2 insertions(+), 1 deletion(-) | |
10 | ||
11 | --- texlive-bin.orig/texk/web2c/pdftexdir/utils.c | |
12 | +++ texlive-bin/texk/web2c/pdftexdir/utils.c | |
13 | @@ -870,7 +870,8 @@ | |
14 | int size, len = 0; /* to avoid warning about uninitialized use of len */ | |
15 | ||
16 | boolean found = i < sub_match_count | |
17 | - && match_string != NULL && pmatch[i].rm_so >= 0 && i >= 0; | |
18 | + && match_string != NULL && pmatch[i].rm_so >= 0 && i >= 0 | |
19 | + && pmatch[i].rm_eo >= pmatch[i].rm_so; | |
20 | ||
21 | if (found) { | |
22 | len = pmatch[i].rm_eo - pmatch[i].rm_so; |