php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #42196 unserialize artichecture problem
Submitted: 2007-08-03 09:51 UTC Modified: 2013-08-06 07:56 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: joungkyun at gmail dot com Assigned: yohgaki (profile)
Status: Closed Package: *General Issues
PHP Version: 5CVS-2007-08-03 (CVS) OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: joungkyun at gmail dot com
New email:
PHP Version: OS:

 

 [2007-08-03 09:51 UTC] joungkyun at gmail dot com
Description:
------------
There is serialized data that made with 64bit integer on 64 bit system.

On 32bit machine, if unserialize this data, you have result of integer overflow.


Reproduce code:
---------------
On, 64bit system

echo serialize (4294967296 + 1);

=> result : "i:4294967297;"

On, 32bit system

echo unserilaize ("i:4294967297;");

=> result : 1

Expected result:
----------------
On, 32bit system

echo unserilaize ("i:4294967297;");

=> result : 4294967297

Actual result:
--------------
On, 32bit system

echo unserilaize ("i:4294967297;");

=> result : 1

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-04 14:08 UTC] jani@php.net
First of all, exactly why do you pass data like this between machines?
Secondly: OF course you can't pass huge integers to 32bit system. So 
this is expected behaviour. What do you suggest happens in this case?

Try this on 32bit system: 

echo (int) 4294967297;

 [2007-08-04 16:42 UTC] joungkyun at gmail dot com
I thinks that php has auto casting type. So, on 32bit systems php get 64bit interger, first convert casting type to double.

sorry for my pool english.
 [2013-08-06 07:56 UTC] yohgaki@php.net
-Status: Open +Status: Closed -Package: Feature/Change Request +Package: *General Issues -Assigned To: +Assigned To: yohgaki
 [2013-08-06 07:56 UTC] yohgaki@php.net
Already implemented at least 5.4
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun May 04 02:01:29 2025 UTC