File: bug001.phpt

package info (click to toggle)
php-mailparse 3.0.2%2B2.1.6-12-gae1ef14-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,524 kB
  • ctags: 529
  • sloc: ansic: 3,936; xml: 203; php: 38; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 685 bytes parent folder | download | duplicates (5)
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
--TEST--
mailparse_msg_free causes double free segfault
--SKIPIF--
<?php
if (!extension_loaded("mailparse")) print "skip"; ?>
--FILE--
<?php
$path =  dirname(__FILE__) . '/testdata/m0001.txt';

$resource = mailparse_msg_parse_file($path);
$stream = fopen($path, 'r');

$structure = mailparse_msg_get_structure($resource);
$parts = array();
foreach ($structure as $part_id) {
            $part = mailparse_msg_get_part($resource, $part_id);
            $parts[$part_id] = mailparse_msg_get_part_data($part);
}

if (is_resource($stream)) {
    fclose($stream);
}
if (is_resource($resource)) {
    mailparse_msg_free($resource);
}
print 'No Segfault!' . PHP_EOL;

--EXPECT--
No Segfault!