|
1 170_php_18368630.patch continued. |
|
2 This corrects parts of the above patch because of context diffs. |
|
3 |
|
4 |
|
5 --- php-5.3.28/ext/fileinfo/libmagic/softmagic.c_orig 2013-12-10 11:04:57.000000000 -0800 |
|
6 +++ php-5.3.28/ext/fileinfo/libmagic/softmagic.c 2014-03-10 16:11:12.236393936 -0700 |
|
7 @@ -1500,14 +1500,14 @@ |
|
8 /* Verify we have enough data to match magic type */ |
|
9 switch (m->type) { |
|
10 case FILE_BYTE: |
|
11 - if (nbytes < (offset + 1)) /* should alway be true */ |
|
12 + if (OFFSET_OOB(nbytes, offset, 1)) /* should alway be true */ |
|
13 return 0; |
|
14 break; |
|
15 |
|
16 case FILE_SHORT: |
|
17 case FILE_BESHORT: |
|
18 case FILE_LESHORT: |
|
19 - if (nbytes < (offset + 2)) |
|
20 + if (OFFSET_OOB(nbytes, offset, 2)) |
|
21 return 0; |
|
22 break; |
|
23 |
|
24 @@ -1526,26 +1526,26 @@ |
|
25 case FILE_FLOAT: |
|
26 case FILE_BEFLOAT: |
|
27 case FILE_LEFLOAT: |
|
28 - if (nbytes < (offset + 4)) |
|
29 + if (OFFSET_OOB(nbytes, offset, 4)) |
|
30 return 0; |
|
31 break; |
|
32 |
|
33 case FILE_DOUBLE: |
|
34 case FILE_BEDOUBLE: |
|
35 case FILE_LEDOUBLE: |
|
36 - if (nbytes < (offset + 8)) |
|
37 + if (OFFSET_OOB(nbytes, offset, 8)) |
|
38 return 0; |
|
39 break; |
|
40 |
|
41 case FILE_STRING: |
|
42 case FILE_PSTRING: |
|
43 case FILE_SEARCH: |
|
44 - if (nbytes < (offset + m->vallen)) |
|
45 + if (OFFSET_OOB(nbytes, offset, m->vallen)) |
|
46 return 0; |
|
47 break; |
|
48 |
|
49 case FILE_REGEX: |
|
50 - if (nbytes < offset) |
|
51 + if (OFFSET_OOB(nbytes, offset, 0)) |
|
52 return 0; |
|
53 break; |
|
54 |
|
55 @@ -1553,7 +1553,7 @@ |
|
56 if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 && |
|
57 file_printf(ms, "%s", m->desc) == -1) |
|
58 return -1; |
|
59 - if (nbytes < offset) |
|
60 + if (OFFSET_OOB(nbytes, offset, 0)) |
|
61 return 0; |
|
62 return file_softmagic(ms, s + offset, nbytes - offset, |
|
63 BINTEST, text); |