X7ROOT File Manager
Current Path:
/opt/alt/tests/alt-php85-pecl-mailparse_3.2.0-1.el8/tests
opt
/
alt
/
tests
/
alt-php85-pecl-mailparse_3.2.0-1.el8
/
tests
/
??
..
??
001.phpt
(328 B)
??
002.phpt
(571 B)
??
003.phpt
(597 B)
??
004.phpt
(765 B)
??
005.phpt
(948 B)
??
006.phpt
(2.26 KB)
??
007.phpt
(1.15 KB)
??
008.phpt
(354 B)
??
009.phpt
(896 B)
??
010.phpt
(1.27 KB)
??
011.phpt
(678 B)
??
012-stream.phpt
(476 B)
??
012-var.phpt
(465 B)
??
012.phpt
(435 B)
??
013.phpt
(354 B)
??
bug001.phpt
(685 B)
??
bug73110.phpt
(909 B)
??
bug74223.phpt
(705 B)
??
bug75825.phpt
(2.1 KB)
??
bug81403.phpt
(542 B)
??
bug81422.phpt
(424 B)
??
gh19.phpt
(935 B)
??
gh20.phpt
(2.55 KB)
??
gh21.phpt
(1.6 KB)
??
gh22.phpt
(1.76 KB)
??
gh24.phpt
(710 B)
??
gh29.phpt
(598 B)
??
gh30.phpt
(837 B)
??
gh43.phpt
(967 B)
??
gh44.phpt
(2.12 KB)
??
parse_test_messages.phpt
(4.66 KB)
??
testdata
Editing: gh44.phpt
--TEST-- GH issue #44 (Segmentation fault in mimepart resource destructor during shutdown) --SKIPIF-- <?php if (!extension_loaded("mailparse")) die("skip mailparse extension not available"); ?> --FILE-- <?php /* Generate a multipart message with >300 parts to trigger MAXPARTS. * This exercises the mailparse_msg_parse_file error path which calls * php_mimepart_free() directly, leaving child resources in the resource * list. Without the fix, these dangling resources cause a use-after-free * during shutdown in zend_close_rsrc_list. */ $boundary = "test_boundary"; $mime = "Content-Type: multipart/mixed; boundary=\"$boundary\"\r\n\r\n"; for ($i = 0; $i < 302; $i++) { $mime .= "--$boundary\r\nContent-Type: text/plain\r\n\r\npart $i\r\n"; } $mime .= "--$boundary--\r\n"; $tmpfile = tempnam(sys_get_temp_dir(), 'mp_gh44_'); file_put_contents($tmpfile, $mime); /* Parse the oversized message - triggers "MIME message too complex" warning * and the error path calls php_mimepart_free(part) directly, freeing the * mimepart struct but leaving child zend_resource entries in the list */ $result = @mailparse_msg_parse_file($tmpfile); echo "parse_file returned: " . var_export($result, true) . "\n"; /* Allocate many messages to reuse freed memory from the failed parse above. * This increases the chance that the dangling resource pointers from the * failed parse will reference reused/corrupted memory at shutdown. */ $msgs = []; for ($i = 0; $i < 50; $i++) { $m = mailparse_msg_create(); mailparse_msg_parse($m, "Content-Type: multipart/mixed; boundary=\"b\"\r\n\r\n" . "--b\r\nContent-Type: text/plain\r\n\r\nhello\r\n" . "--b\r\nContent-Type: text/html\r\n\r\n<b>hi</b>\r\n--b--\r\n"); $msgs[] = $m; } /* Also test normal multipart parsing and cleanup */ $msg = mailparse_msg_create(); mailparse_msg_parse($msg, "Content-Type: multipart/mixed; boundary=\"x\"\r\n\r\n" . "--x\r\nContent-Type: text/plain\r\n\r\nhello\r\n--x--\r\n"); $struct = mailparse_msg_get_structure($msg); echo "structure: " . implode(", ", $struct) . "\n"; unlink($tmpfile); echo "ok\n"; ?> --EXPECT-- parse_file returned: false structure: 1, 1.1 ok
Upload File
Create Folder