php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62824 Invalid read in strptime
Submitted: 2012-08-15 05:05 UTC Modified: 2012-08-15 13:15 UTC
From: rasmus@php.net Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.4Git-2012-08-15 (Git) OS: Linux
Private report: No CVE-ID: None
 [2012-08-15 05:05 UTC] rasmus@php.net
Description:
------------
==26201== Invalid read of size 8
==26201==    at 0x8355A84: __GI___strncasecmp_l (strcmp.S:1862)
==26201==    by 0x8377F16: __strptime_internal (strptime_l.c:420)
==26201==    by 0x6DA392: zif_strptime (datetime.c:101)
==26201==    by 0x874BE8: zend_do_fcall_common_helper_SPEC 
(zend_vm_execute.h:642)
==26201==    by 0x82F10E: execute (zend_vm_execute.h:410)
==26201==    by 0x7D0376: zend_execute_scripts (zend.c:1286)
==26201==    by 0x76FED2: php_execute_script (main.c:2473)
==26201==    by 0x87724E: do_cli (php_cli.c:988)
==26201==    by 0x439C6D: main (php_cli.c:1364)
==26201==  Address 0xe750948 is 0 bytes after a block of size 8 alloc'd
==26201==    at 0x4C2C56F: malloc (vg_replace_malloc.c:267)
==26201==    by 0x7AA930: _estrndup (zend_alloc.c:2596)
==26201==    by 0x7CDD2B: _zval_copy_ctor_func (zend_variables.c:121)
==26201==    by 0x7FD79F: ZEND_SEND_VAL_SPEC_CONST_HANDLER (zend_variables.h:45)
==26201==    by 0x82F10E: execute (zend_vm_execute.h:410)
==26201==    by 0x7D0376: zend_execute_scripts (zend.c:1286)
==26201==    by 0x76FED2: php_execute_script (main.c:2473)
==26201==    by 0x87724E: do_cli (php_cli.c:988)
==26201==    by 0x439C6D: main (php_cli.c:1364)
==26201== 
==26201== Invalid read of size 8
==26201==    at 0x8353C5C: __GI___strncasecmp_l (strcmp.S:216)
==26201==    by 0x8377FAC: __strptime_internal (strptime_l.c:431)
==26201==    by 0x6DA392: zif_strptime (datetime.c:101)
==26201==    by 0x874BE8: zend_do_fcall_common_helper_SPEC 
(zend_vm_execute.h:642)
==26201==    by 0x82F10E: execute (zend_vm_execute.h:410)
==26201==    by 0x7D0376: zend_execute_scripts (zend.c:1286)
==26201==    by 0x76FED2: php_execute_script (main.c:2473)
==26201==    by 0x87724E: do_cli (php_cli.c:988)
==26201==    by 0x439C6D: main (php_cli.c:1364)
==26201==  Address 0xe750948 is 0 bytes after a block of size 8 alloc'd
==26201==    at 0x4C2C56F: malloc (vg_replace_malloc.c:267)
==26201==    by 0x7AA930: _estrndup (zend_alloc.c:2596)
==26201==    by 0x7CDD2B: _zval_copy_ctor_func (zend_variables.c:121)
==26201==    by 0x7FD79F: ZEND_SEND_VAL_SPEC_CONST_HANDLER (zend_variables.h:45)
==26201==    by 0x82F10E: execute (zend_vm_execute.h:410)
==26201==    by 0x7D0376: zend_execute_scripts (zend.c:1286)
==26201==    by 0x76FED2: php_execute_script (main.c:2473)
==26201==    by 0x87724E: do_cli (php_cli.c:988)
==26201==    by 0x439C6D: main (php_cli.c:1364)
==26201== 
==26201== Invalid read of size 8
==26201==    at 0x8355A84: __GI___strncasecmp_l (strcmp.S:1862)
==26201==    by 0x837802B: __strptime_internal (strptime_l.c:444)
==26201==    by 0x6DA392: zif_strptime (datetime.c:101)
==26201==    by 0x874BE8: zend_do_fcall_common_helper_SPEC 
(zend_vm_execute.h:642)
==26201==    by 0x82F10E: execute (zend_vm_execute.h:410)
==26201==    by 0x7D0376: zend_execute_scripts (zend.c:1286)
==26201==    by 0x76FED2: php_execute_script (main.c:2473)
==26201==    by 0x87724E: do_cli (php_cli.c:988)
==26201==    by 0x439C6D: main (php_cli.c:1364)
==26201==  Address 0xe750948 is 0 bytes after a block of size 8 alloc'd
==26201==    at 0x4C2C56F: malloc (vg_replace_malloc.c:267)
==26201==    by 0x7AA930: _estrndup (zend_alloc.c:2596)
==26201==    by 0x7CDD2B: _zval_copy_ctor_func (zend_variables.c:121)
==26201==    by 0x7FD79F: ZEND_SEND_VAL_SPEC_CONST_HANDLER (zend_variables.h:45)
==26201==    by 0x82F10E: execute (zend_vm_execute.h:410)
==26201==    by 0x7D0376: zend_execute_scripts (zend.c:1286)
==26201==    by 0x76FED2: php_execute_script (main.c:2473)
==26201==    by 0x87724E: do_cli (php_cli.c:988)
==26201==    by 0x439C6D: main (php_cli.c:1364)
==26201== 
==26201== Invalid read of size 8
==26201==    at 0x8353C5C: __GI___strncasecmp_l (strcmp.S:216)
==26201==    by 0x8378520: __strptime_internal (strptime_l.c:446)
==26201==    by 0x6DA392: zif_strptime (datetime.c:101)
==26201==    by 0x874BE8: zend_do_fcall_common_helper_SPEC 
(zend_vm_execute.h:642)
==26201==    by 0x82F10E: execute (zend_vm_execute.h:410)
==26201==    by 0x7D0376: zend_execute_scripts (zend.c:1286)
==26201==    by 0x76FED2: php_execute_script (main.c:2473)
==26201==    by 0x87724E: do_cli (php_cli.c:988)
==26201==    by 0x439C6D: main (php_cli.c:1364)
==26201==  Address 0xe750948 is 0 bytes after a block of size 8 alloc'd
==26201==    at 0x4C2C56F: malloc (vg_replace_malloc.c:267)
==26201==    by 0x7AA930: _estrndup (zend_alloc.c:2596)
==26201==    by 0x7CDD2B: _zval_copy_ctor_func (zend_variables.c:121)
==26201==    by 0x7FD79F: ZEND_SEND_VAL_SPEC_CONST_HANDLER (zend_variables.h:45)
==26201==    by 0x82F10E: execute (zend_vm_execute.h:410)
==26201==    by 0x7D0376: zend_execute_scripts (zend.c:1286)
==26201==    by 0x76FED2: php_execute_script (main.c:2473)
==26201==    by 0x87724E: do_cli (php_cli.c:988)
==26201==    by 0x439C6D: main (php_cli.c:1364)
==26201== 
==26201== Invalid read of size 8
==26201==    at 0x8354804: __GI___strncasecmp_l (strcmp.S:862)
==26201==    by 0x8377F16: __strptime_internal (strptime_l.c:420)
==26201==    by 0x6DA392: zif_strptime (datetime.c:101)
==26201==    by 0x874BE8: zend_do_fcall_common_helper_SPEC 
(zend_vm_execute.h:642)
==26201==    by 0x82F10E: execute (zend_vm_execute.h:410)
==26201==    by 0x7D0376: zend_execute_scripts (zend.c:1286)
==26201==    by 0x76FED2: php_execute_script (main.c:2473)
==26201==    by 0x87724E: do_cli (php_cli.c:988)
==26201==    by 0x439C6D: main (php_cli.c:1364)
==26201==  Address 0xe750948 is 0 bytes after a block of size 8 alloc'd
==26201==    at 0x4C2C56F: malloc (vg_replace_malloc.c:267)
==26201==    by 0x7AA930: _estrndup (zend_alloc.c:2596)
==26201==    by 0x7CDD2B: _zval_copy_ctor_func (zend_variables.c:121)
==26201==    by 0x7FD79F: ZEND_SEND_VAL_SPEC_CONST_HANDLER (zend_variables.h:45)
==26201==    by 0x82F10E: execute (zend_vm_execute.h:410)
==26201==    by 0x7D0376: zend_execute_scripts (zend.c:1286)
==26201==    by 0x76FED2: php_execute_script (main.c:2473)
==26201==    by 0x87724E: do_cli (php_cli.c:988)
==26201==    by 0x439C6D: main (php_cli.c:1364)
==26201== 
==26201== Invalid read of size 8
==26201==    at 0x8354804: __GI___strncasecmp_l (strcmp.S:862)
==26201==    by 0x837802B: __strptime_internal (strptime_l.c:444)
==26201==    by 0x6DA392: zif_strptime (datetime.c:101)
==26201==    by 0x874BE8: zend_do_fcall_common_helper_SPEC 
(zend_vm_execute.h:642)
==26201==    by 0x82F10E: execute (zend_vm_execute.h:410)
==26201==    by 0x7D0376: zend_execute_scripts (zend.c:1286)
==26201==    by 0x76FED2: php_execute_script (main.c:2473)
==26201==    by 0x87724E: do_cli (php_cli.c:988)
==26201==    by 0x439C6D: main (php_cli.c:1364)
==26201==  Address 0xe750948 is 0 bytes after a block of size 8 alloc'd
==26201==    at 0x4C2C56F: malloc (vg_replace_malloc.c:267)
==26201==    by 0x7AA930: _estrndup (zend_alloc.c:2596)
==26201==    by 0x7CDD2B: _zval_copy_ctor_func (zend_variables.c:121)
==26201==    by 0x7FD79F: ZEND_SEND_VAL_SPEC_CONST_HANDLER (zend_variables.h:45)
==26201==    by 0x82F10E: execute (zend_vm_execute.h:410)
==26201==    by 0x7D0376: zend_execute_scripts (zend.c:1286)
==26201==    by 0x76FED2: php_execute_script (main.c:2473)
==26201==    by 0x87724E: do_cli (php_cli.c:988)
==26201==    by 0x439C6D: main (php_cli.c:1364)
==26201== 
==26201== Invalid read of size 8
==26201==    at 0x8353C5C: __GI___strncasecmp_l (strcmp.S:216)
==26201==    by 0x8377F16: __strptime_internal (strptime_l.c:420)
==26201==    by 0x6DA392: zif_strptime (datetime.c:101)
==26201==    by 0x874BE8: zend_do_fcall_common_helper_SPEC 
(zend_vm_execute.h:642)
==26201==    by 0x82F10E: execute (zend_vm_execute.h:410)
==26201==    by 0x7D0376: zend_execute_scripts (zend.c:1286)
==26201==    by 0x76FED2: php_execute_script (main.c:2473)
==26201==    by 0x87724E: do_cli (php_cli.c:988)
==26201==    by 0x439C6D: main (php_cli.c:1364)
==26201==  Address 0xe750948 is 0 bytes after a block of size 8 alloc'd
==26201==    at 0x4C2C56F: malloc (vg_replace_malloc.c:267)
==26201==    by 0x7AA930: _estrndup (zend_alloc.c:2596)
==26201==    by 0x7CDD2B: _zval_copy_ctor_func (zend_variables.c:121)
==26201==    by 0x7FD79F: ZEND_SEND_VAL_SPEC_CONST_HANDLER (zend_variables.h:45)
==26201==    by 0x82F10E: execute (zend_vm_execute.h:410)
==26201==    by 0x7D0376: zend_execute_scripts (zend.c:1286)
==26201==    by 0x76FED2: php_execute_script (main.c:2473)
==26201==    by 0x87724E: do_cli (php_cli.c:988)
==26201==    by 0x439C6D: main (php_cli.c:1364)
==26201== 
==26201== Invalid read of size 8
==26201==    at 0x8353C5C: __GI___strncasecmp_l (strcmp.S:216)
==26201==    by 0x837802B: __strptime_internal (strptime_l.c:444)
==26201==    by 0x6DA392: zif_strptime (datetime.c:101)
==26201==    by 0x874BE8: zend_do_fcall_common_helper_SPEC 
(zend_vm_execute.h:642)
==26201==    by 0x82F10E: execute (zend_vm_execute.h:410)
==26201==    by 0x7D0376: zend_execute_scripts (zend.c:1286)
==26201==    by 0x76FED2: php_execute_script (main.c:2473)
==26201==    by 0x87724E: do_cli (php_cli.c:988)
==26201==    by 0x439C6D: main (php_cli.c:1364)
==26201==  Address 0xe750948 is 0 bytes after a block of size 8 alloc'd
==26201==    at 0x4C2C56F: malloc (vg_replace_malloc.c:267)
==26201==    by 0x7AA930: _estrndup (zend_alloc.c:2596)
==26201==    by 0x7CDD2B: _zval_copy_ctor_func (zend_variables.c:121)
==26201==    by 0x7FD79F: ZEND_SEND_VAL_SPEC_CONST_HANDLER (zend_variables.h:45)
==26201==    by 0x82F10E: execute (zend_vm_execute.h:410)
==26201==    by 0x7D0376: zend_execute_scripts (zend.c:1286)
==26201==    by 0x76FED2: php_execute_script (main.c:2473)
==26201==    by 0x87724E: do_cli (php_cli.c:988)
==26201==    by 0x439C6D: main (php_cli.c:1364)
==26201== 
==26201== Invalid read of size 8
==26201==    at 0x83545B4: __GI___strncasecmp_l (strcmp.S:737)
==26201==    by 0x8377F16: __strptime_internal (strptime_l.c:420)
==26201==    by 0x6DA392: zif_strptime (datetime.c:101)
==26201==    by 0x874BE8: zend_do_fcall_common_helper_SPEC 
(zend_vm_execute.h:642)
==26201==    by 0x82F10E: execute (zend_vm_execute.h:410)
==26201==    by 0x7D0376: zend_execute_scripts (zend.c:1286)
==26201==    by 0x76FED2: php_execute_script (main.c:2473)
==26201==    by 0x87724E: do_cli (php_cli.c:988)
==26201==    by 0x439C6D: main (php_cli.c:1364)
==26201==  Address 0xe750948 is 0 bytes after a block of size 8 alloc'd
==26201==    at 0x4C2C56F: malloc (vg_replace_malloc.c:267)
==26201==    by 0x7AA930: _estrndup (zend_alloc.c:2596)
==26201==    by 0x7CDD2B: _zval_copy_ctor_func (zend_variables.c:121)
==26201==    by 0x7FD79F: ZEND_SEND_VAL_SPEC_CONST_HANDLER (zend_variables.h:45)
==26201==    by 0x82F10E: execute (zend_vm_execute.h:410)
==26201==    by 0x7D0376: zend_execute_scripts (zend.c:1286)
==26201==    by 0x76FED2: php_execute_script (main.c:2473)
==26201==    by 0x87724E: do_cli (php_cli.c:988)
==26201==    by 0x439C6D: main (php_cli.c:1364)
==26201== 
==26201== Invalid read of size 8
==26201==    at 0x83545B4: __GI___strncasecmp_l (strcmp.S:737)
==26201==    by 0x837802B: __strptime_internal (strptime_l.c:444)
==26201==    by 0x6DA392: zif_strptime (datetime.c:101)
==26201==    by 0x874BE8: zend_do_fcall_common_helper_SPEC 
(zend_vm_execute.h:642)
==26201==    by 0x82F10E: execute (zend_vm_execute.h:410)
==26201==    by 0x7D0376: zend_execute_scripts (zend.c:1286)
==26201==    by 0x76FED2: php_execute_script (main.c:2473)
==26201==    by 0x87724E: do_cli (php_cli.c:988)
==26201==    by 0x439C6D: main (php_cli.c:1364)
==26201==  Address 0xe750948 is 0 bytes after a block of size 8 alloc'd
==26201==    at 0x4C2C56F: malloc (vg_replace_malloc.c:267)
==26201==    by 0x7AA930: _estrndup (zend_alloc.c:2596)
==26201==    by 0x7CDD2B: _zval_copy_ctor_func (zend_variables.c:121)
==26201==    by 0x7FD79F: ZEND_SEND_VAL_SPEC_CONST_HANDLER (zend_variables.h:45)
==26201==    by 0x82F10E: execute (zend_vm_execute.h:410)
==26201==    by 0x7D0376: zend_execute_scripts (zend.c:1286)
==26201==    by 0x76FED2: php_execute_script (main.c:2473)
==26201==    by 0x87724E: do_cli (php_cli.c:988)
==26201==    by 0x439C6D: main (php_cli.c:1364)

Test script:
---------------
$orig = setlocale(LC_ALL, 'C');
date_default_timezone_set("GMT");
$res = strptime("July 10", '%B %H');
var_dump($res["tm_year"]);


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-08-15 13:15 UTC] rasmus@php.net
-Status: Open +Status: Not a bug
 [2012-08-15 13:15 UTC] rasmus@php.net
Looks like this was a false positive from an svn-version of Valgrind. Current 
Valgrind 3.8.0 doesn't see an invalid read here.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 21:01:33 2025 UTC