|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72828 superfluous NULL check in php_strtr_array
Submitted: 2016-08-13 11:45 UTC Modified: 2016-08-13 14:45 UTC
From: Assigned: cmb (profile)
Status: Not a bug Package: Strings related
PHP Version: 5.6Git-2016-08-13 (Git) OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
16 + 50 = ?
Subscribe to this entry?

 [2016-08-13 11:45 UTC]
In php_strtr_array_prepare_repls() `patterns` and `*allocs` are
allocated on the heap, but it is not checked whether that might
have failed, what can lead to OOB writes.

This may not be a problem with the Zend MM, but can be with other
memory managers.

If that also affects PHP 7 (where strtr() had be reimplemented),
has to be checked.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-08-13 11:45 UTC]
-Assigned To: +Assigned To: cmb
 [2016-08-13 12:05 UTC]
Unless the allocations explicitly use the system allocator (i.e. do not use emalloc and variants), do NOT introduce NULL checks.
 [2016-08-13 13:39 UTC]
-Summary: php_strtr_array_prepare_repls does not check allocation results +Summary: superfluous NULL check in php_strtr_array
 [2016-08-13 13:39 UTC]
That has been further clarified on the internals mailing list[1].
So I'm changing the bug wrt. to the superfluous NULL check in

[1] <>
[2] <>
 [2016-08-13 14:45 UTC]
-Status: Assigned +Status: Not a bug
 [2016-08-13 14:45 UTC]
I've found that this issue indeed only affects PHP 5. After
reconsideration I think the NULL check is harmless – at least it
is not a bug.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Jul 04 23:05:45 2022 UTC