|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67245 usage of memcpy() with overlapping src and dst in zend_exceptions.c
Submitted: 2014-05-11 12:27 UTC Modified: 2014-05-11 13:18 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: gm dot outside+php at gmail dot com Assigned: bwoebi (profile)
Status: Closed Package: *General Issues
PHP Version: 5.5.12 OS: Linux
Private report: No CVE-ID: None
 [2014-05-11 12:27 UTC] gm dot outside+php at gmail dot com
According to man page for memcpy(3) the function should not be used with overlapping source and destination arguments.  A recent update to Zend/zend_exceptions.c (commit:;a=commitdiff;h=afa03a470ef90a53f2b59a8175f77afdb6b5a651) introduced formatting of trace's arguments where it uses memcpy() with overlapping addresses.  This causes issues on at least systems with glibc 2.3.6 and the testsuite on such systems fails.

If one replaces memcpy() with memmove() the testsuite will pass again.

P.S. I believe that there should be a more efficient way to achieve the string formatting since re-allocating string byte by byte should be very inefficient, but this is unrelated to the bug at hand.


zend_exceptions-memmove (last revision 2014-05-11 12:27 UTC by gm dot outside+php at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-05-11 12:30 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: bwoebi
 [2014-05-11 12:59 UTC]
-Status: Assigned +Status: Closed
 [2014-05-11 12:59 UTC]
That bug had already been fixed in;a=commitdiff;h=0e273217cfd1e72b5109a880fb4334edd2f61448 … I had noticed it later...
 [2014-05-11 13:09 UTC]
-Status: Closed +Status: Re-Opened
 [2014-05-11 13:09 UTC]
Oh, wait, I've merged it into the wrong branch, will fix.
 [2014-05-11 13:18 UTC]
-Status: Re-Opened +Status: Closed
 [2014-05-11 13:18 UTC]
Cherry-picked fix for 5.4 and 5.5. Now everything should be right.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Dec 04 17:01:27 2023 UTC