René's URL Explorer Experiment


Title: Possible memory leak in `php_msgpack_unserialize` · Issue #176 · msgpack/msgpack-php · GitHub

Open Graph Title: Possible memory leak in `php_msgpack_unserialize` · Issue #176 · msgpack/msgpack-php

X Title: Possible memory leak in `php_msgpack_unserialize` · Issue #176 · msgpack/msgpack-php

Description: Hi 👋, I came across a possible memory leak in msgpack I can reproduce the leak in php 8.2 and 8.3 and in msgpack 2.2.0, 3.0.0, and master.

Open Graph Description: Hi 👋, I came across a possible memory leak in msgpack I can reproduce the leak in php 8.2 and 8.3 and in msgpack 2.2.0, 3.0.0, and master.

X Description: Hi 👋, I came across a possible memory leak in msgpack I can reproduce the leak in php 8.2 and 8.3 and in msgpack 2.2.0, 3.0.0, and master. <?php $data = hex2bin('89716235369266a1b03065623831...

Opengraph URL: https://github.com/msgpack/msgpack-php/issues/176

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Possible memory leak in `php_msgpack_unserialize`","articleBody":"Hi :wave:,\r\n\r\nI came across a possible memory leak in msgpack \r\n\r\nI can reproduce the leak in php `8.2` and `8.3` and in msgpack `2.2.0`, `3.0.0`, and `master`. \r\n\r\n```php\r\n\u003c?php\r\n$data = hex2bin('89716235369266a1b030656238313037383332393464363764');\r\n$unserialized = msgpack_unserialize($data);\r\n// var_dump($unserialized);\r\n```\r\n\r\nOutput:\r\n```bash\r\n❯ sapi/cli/php msgpack-reproducer.php\r\n\r\nWarning: [msgpack] (msgpack_unserialize_map_item) illegal key type in /home/mike/dev/phpfarm/src/php-8.3.11-debug/msgpack-reproducer.php on line 5\r\n\r\nWarning: Array to string conversion in /home/mike/dev/phpfarm/src/php-8.3.11-debug/msgpack-reproducer.php on line 5\r\n\r\nWarning: [msgpack] (php_msgpack_unserialize) Extra bytes in /home/mike/dev/phpfarm/src/php-8.3.11-debug/msgpack-reproducer.php on line 5\r\n[Thu Oct  3 10:31:36 2024]  Script:  '/home/mike/dev/phpfarm/src/php-8.3.11-debug/msgpack-reproducer.php'\r\n/home/mike/dev/phpfarm/src/php-8.3.11-debug/Zend/zend_string.h(174) :  Freeing 0x0000749bd1203c40 (32 bytes), script=/home/mike/dev/phpfarm/src/php-8.3.11-debug/msgpack-reproducer.php\r\n[Thu Oct  3 10:31:36 2024]  Script:  '/home/mike/dev/phpfarm/src/php-8.3.11-debug/msgpack-reproducer.php'\r\n/home/mike/dev/phpfarm/src/php-8.3.11-debug/Zend/zend_hash.c(291) :  Freeing 0x0000749bd125db40 (56 bytes), script=/home/mike/dev/phpfarm/src/php-8.3.11-debug/msgpack-reproducer.php\r\n[Thu Oct  3 10:31:36 2024]  Script:  '/home/mike/dev/phpfarm/src/php-8.3.11-debug/msgpack-reproducer.php'\r\n/home/mike/dev/phpfarm/src/php-8.3.11-debug/Zend/zend_hash.c(157) :  Freeing 0x0000749bd1261180 (136 bytes), script=/home/mike/dev/phpfarm/src/php-8.3.11-debug/msgpack-reproducer.php\r\n=== Total 3 memory leaks detected ===\r\n\r\n```\r\n\r\nValgrind has more info:\r\n\r\n```bash\r\n$ USE_ZEND_ALLOC=0 valgrind sapi/cli/php --leak-check=full msgpack-reproducer.php\r\n=620239== Command: sapi/cli/php msgpack-reproducer.php\r\n==620239==\r\n\r\nWarning: [msgpack] (msgpack_unserialize_map_item) illegal key type in /home/mike/dev/phpfarm/src/php-8.3.11-debug/msgpack-reproducer.php on line 5\r\n\r\nWarning: Array to string conversion in /home/mike/dev/phpfarm/src/php-8.3.11-debug/msgpack-reproducer.php on line 5\r\n\r\nWarning: [msgpack] (php_msgpack_unserialize) Extra bytes in /home/mike/dev/phpfarm/src/php-8.3.11-debug/msgpack-reproducer.php on line 5\r\n==620239==\r\n==620239== HEAP SUMMARY:\r\n==620239==     in use at exit: 224 bytes in 3 blocks\r\n==620239==   total heap usage: 31,171 allocs, 31,167 frees, 21,577,011 bytes allocated\r\n==620239==\r\n==620239== 224 (56 direct, 168 indirect) bytes in 1 blocks are definitely lost in loss record 3 of 3\r\n==620239==    at 0x484977B: malloc (vg_replace_malloc.c:446)\r\n==620239==    by 0xD9BD5B: __zend_malloc (zend_alloc.c:3128)\r\n==620239==    by 0xD9A9B0: _malloc_custom (zend_alloc.c:2491)\r\n==620239==    by 0xD9AAEE: _emalloc (zend_alloc.c:2610)\r\n==620239==    by 0xDED989: _zend_new_array (zend_hash.c:291)\r\n==620239==    by 0x8CA788: msgpack_unserialize_array (msgpack_unpack.c:550)\r\n==620239==    by 0x8C39BA: msgpack_unserialize_execute (unpack_template.h:231)\r\n==620239==    by 0x8C4B9D: php_msgpack_unserialize (msgpack.c:252)\r\n==620239==    by 0x8C4F2D: zif_msgpack_unserialize (msgpack.c:318)\r\n==620239==    by 0xE18118: ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER (zend_vm_execute.h:1337)\r\n==620239==    by 0xE8DBD3: execute_ex (zend_vm_execute.h:57216)\r\n==620239==    by 0xE92419: zend_execute (zend_vm_execute.h:61604)\r\n==620239==\r\n==620239== LEAK SUMMARY:\r\n==620239==    definitely lost: 56 bytes in 1 blocks\r\n==620239==    indirectly lost: 168 bytes in 2 blocks\r\n==620239==      possibly lost: 0 bytes in 0 blocks\r\n==620239==    still reachable: 0 bytes in 0 blocks\r\n==620239==         suppressed: 0 bytes in 0 blocks\r\n```\r\n\r\nVersion info:\r\n\r\n```bash\r\nPHP 8.3.11 (cli) (built: Sep 15 2024 18:27:47) (NTS DEBUG)\r\nCopyright (c) The PHP Group\r\nZend Engine v4.3.11, Copyright (c) Zend Technologies\r\n\r\nmsgpack\r\n\r\nMessagePack Support =\u003e enabled\r\nSession Support =\u003e enabled\r\nMessagePack APCu Serializer ABI =\u003e no\r\nextension Version =\u003e 3.0.0\r\nheader Version =\u003e 3.2.0\r\n\r\nDirective =\u003e Local Value =\u003e Master Value\r\nmsgpack.error_display =\u003e On =\u003e On\r\nmsgpack.php_only =\u003e On =\u003e On\r\nmsgpack.assoc =\u003e On =\u003e On\r\nmsgpack.illegal_key_insert =\u003e Off =\u003e Off\r\nmsgpack.use_str8_serialization =\u003e On =\u003e On\r\n```\r\n\r\nLet me know if you need any more information. I might try and track it down but I'm not very familiar with the internal working of the library :smile:","author":{"url":"https://github.com/michael-grunder","@type":"Person","name":"michael-grunder"},"datePublished":"2024-10-03T17:45:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/176/msgpack-php/issues/176"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:61a40335-a15d-7154-2cc8-c05d1e3257b2
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB050:37FB75:86E816C:B1D3A4A:696DEFD2
html-safe-nonce1d55cee64ba99d794c3901c90e9d185d54f02e84d6b58066c134766ded7fd069
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMDUwOjM3RkI3NTo4NkU4MTZDOkIxRDNBNEE6Njk2REVGRDIiLCJ2aXNpdG9yX2lkIjoiODUzMjg0MTEzODIzNjU1MTEyMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacfc8402c31acbaaa882f012084a341c54a4675015f59248e8805f36c241867604
hovercard-subject-tagissue:2564645606
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/msgpack/msgpack-php/176/issue_layout
twitter:imagehttps://opengraph.githubassets.com/4d1cc15dfc170f3358444c0c0a410b1f25013e857fb1ec9d99df4de024e6d446/msgpack/msgpack-php/issues/176
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/4d1cc15dfc170f3358444c0c0a410b1f25013e857fb1ec9d99df4de024e6d446/msgpack/msgpack-php/issues/176
og:image:altHi 👋, I came across a possible memory leak in msgpack I can reproduce the leak in php 8.2 and 8.3 and in msgpack 2.2.0, 3.0.0, and master.
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemichael-grunder
hostnamegithub.com
expected-hostnamegithub.com
None4922b452d03cd8dbce479d866a11bc25b59ef6ee2da23aa9b0ddefa6bd4d0064
turbo-cache-controlno-preview
go-importgithub.com/msgpack/msgpack-php git https://github.com/msgpack/msgpack-php.git
octolytics-dimension-user_id198264
octolytics-dimension-user_loginmsgpack
octolytics-dimension-repository_id5481147
octolytics-dimension-repository_nwomsgpack/msgpack-php
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id5481147
octolytics-dimension-repository_network_root_nwomsgpack/msgpack-php
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release7e5ae23c70136152637ceee8d6faceb35596ec46
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/msgpack/msgpack-php/issues/176#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmsgpack%2Fmsgpack-php%2Fissues%2F176
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmsgpack%2Fmsgpack-php%2Fissues%2F176
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=msgpack%2Fmsgpack-php
Reloadhttps://patch-diff.githubusercontent.com/msgpack/msgpack-php/issues/176
Reloadhttps://patch-diff.githubusercontent.com/msgpack/msgpack-php/issues/176
Reloadhttps://patch-diff.githubusercontent.com/msgpack/msgpack-php/issues/176
msgpack https://patch-diff.githubusercontent.com/msgpack
msgpack-phphttps://patch-diff.githubusercontent.com/msgpack/msgpack-php
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fmsgpack%2Fmsgpack-php
Fork 118 https://patch-diff.githubusercontent.com/login?return_to=%2Fmsgpack%2Fmsgpack-php
Star 786 https://patch-diff.githubusercontent.com/login?return_to=%2Fmsgpack%2Fmsgpack-php
Code https://patch-diff.githubusercontent.com/msgpack/msgpack-php
Issues 19 https://patch-diff.githubusercontent.com/msgpack/msgpack-php/issues
Pull requests 1 https://patch-diff.githubusercontent.com/msgpack/msgpack-php/pulls
Actions https://patch-diff.githubusercontent.com/msgpack/msgpack-php/actions
Security Uh oh! There was an error while loading. Please reload this page. https://patch-diff.githubusercontent.com/msgpack/msgpack-php/security
Please reload this pagehttps://patch-diff.githubusercontent.com/msgpack/msgpack-php/issues/176
Insights https://patch-diff.githubusercontent.com/msgpack/msgpack-php/pulse
Code https://patch-diff.githubusercontent.com/msgpack/msgpack-php
Issues https://patch-diff.githubusercontent.com/msgpack/msgpack-php/issues
Pull requests https://patch-diff.githubusercontent.com/msgpack/msgpack-php/pulls
Actions https://patch-diff.githubusercontent.com/msgpack/msgpack-php/actions
Security https://patch-diff.githubusercontent.com/msgpack/msgpack-php/security
Insights https://patch-diff.githubusercontent.com/msgpack/msgpack-php/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/msgpack/msgpack-php/issues/176
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/msgpack/msgpack-php/issues/176
Possible memory leak in php_msgpack_unserializehttps://patch-diff.githubusercontent.com/msgpack/msgpack-php/issues/176#top
https://github.com/michael-grunder
https://github.com/michael-grunder
michael-grunderhttps://github.com/michael-grunder
on Oct 3, 2024https://github.com/msgpack/msgpack-php/issues/176#issue-2564645606
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.