blob: bfcd058d53eaf6c5f881794e65f72e253e685a28 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
Backported from 5.5 for 5.4
binary patch dropped
From d698f0ae51f67c9cce870b09c59df3d6ba959244 Mon Sep 17 00:00:00 2001
From: Stanislav Malyshev <stas@php.net>
Date: Mon, 28 Sep 2015 15:51:59 -0700
Subject: [PATCH] Fix bug #69720: Null pointer dereference in
phar_get_fp_offset()
---
ext/phar/tests/bug69720.phar | Bin 0 -> 8192 bytes
ext/phar/tests/bug69720.phpt | 40 ++++++++++++++++++++++++++++++++++++++++
ext/phar/util.c | 6 +++++-
3 files changed, 45 insertions(+), 1 deletion(-)
create mode 100644 ext/phar/tests/bug69720.phar
create mode 100644 ext/phar/tests/bug69720.phpt
diff --git a/ext/phar/util.c b/ext/phar/util.c
index 2c41adf..69da7b9 100644
--- a/ext/phar/util.c
+++ b/ext/phar/util.c
@@ -716,7 +716,11 @@ really_get_entry:
(*ret)->is_tar = entry->is_tar;
(*ret)->fp = phar_get_efp(entry, 1 TSRMLS_CC);
if (entry->link) {
- (*ret)->zero = phar_get_fp_offset(phar_get_link_source(entry TSRMLS_CC) TSRMLS_CC);
+ phar_entry_info *link = phar_get_link_source(entry TSRMLS_CC);
+ if(!link) {
+ return FAILURE;
+ }
+ (*ret)->zero = phar_get_fp_offset(link TSRMLS_CC);
} else {
(*ret)->zero = phar_get_fp_offset(entry TSRMLS_CC);
}
--
2.1.4
From f98ab19dc0c978e3caaa2614579e4a61f2c317f5 Mon Sep 17 00:00:00 2001
From: Stanislav Malyshev <stas@php.net>
Date: Mon, 28 Sep 2015 20:43:18 -0700
Subject: [PATCH] fix memory leak
---
ext/phar/util.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/ext/phar/util.c b/ext/phar/util.c
index 69da7b9..e7decda 100644
--- a/ext/phar/util.c
+++ b/ext/phar/util.c
@@ -718,6 +718,7 @@ really_get_entry:
if (entry->link) {
phar_entry_info *link = phar_get_link_source(entry TSRMLS_CC);
if(!link) {
+ efree(*ret);
return FAILURE;
}
(*ret)->zero = phar_get_fp_offset(link TSRMLS_CC);
--
2.1.4
|