google-code-backups / sabreamf

Automatically exported from code.google.com/p/sabreamf
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

AMF0 deserializer breaks with references #11

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Open a client connection to a certain server with a certain query
2. SabreAMF crashes with an uncaught exception

What is the expected output? What do you see instead?
I expect a SabreAMF typed object, I see the following PHP error:
Fatal error:  Uncaught exception 'Exception' with message 'Invalid reference 
offset: 14' in 
/var/www/SabreAMF/AMF0/Deserializer.php:112
Stack trace:
#0 /var/www/SabreAMF/AMF0/Deserializer.php(64): SabreAMF_AMF0_Deserializer-
>readReference()
#1 /var/www/SabreAMF/AMF0/Deserializer.php(128): SabreAMF_AMF0_Deserializer-
>readAMFData()
#2 /var/www/SabreAMF/AMF0/Deserializer.php(66): 
SabreAMF_AMF0_Deserializer->readArray()
#3 /var/www/SabreAMF/AMF0/Deserializer.php(205): SabreAMF_AMF0_Deserializer-
>readAMFData(10)
#4 /var/www/SabreAMF/AMF0/Deserializer.php(71): SabreAMF_AMF0_Deserializer-
>readTypedObject()
#5 /var/www/SabreAMF/Message.php(150): 
SabreAMF_AMF0_Deserializer->readAMFData(NULL, 
true)
#6 /var/www/sabreamf-read-only/SabreAMF/Client.php(151): SabreAMF_Message-
>deserialize(Object(SabreAMF_InputStream))
#7 /var/www/testvt.php(7) in /var/www/SabreAMF/AMF0/Deserializer.php on line 112

What version of the product are you using? On what operating system?
Version 1.2.203, PHP 5.2.10 FCGI on lighttpd 1.5.0 on Debian Etch

Please provide any additional information below.
I'm working on an intranet project, so I can't provide you direct access to the 
servlet for tests. 
You'll find the binary output from the server as an attachment to this ticket. 
That's the best I can 
provide. The attached binary output causes SabreAMF to throw an exception.

Original issue reported on code.google.com by j0t...@gmail.com on 26 Jun 2009 at 8:46

Attachments:

GoogleCodeExporter commented 8 years ago
What server are you using?

Original comment by evert...@gmail.com on 26 Jun 2009 at 9:04

GoogleCodeExporter commented 8 years ago
Looking through the AMF0 deserializer, I realize there are a couple of issues

  * Object (and typed object) references are added to the reference list after they
are deserialized. This *could* be an issue for nested references (rare, but 
possible)
  * Arrays (and mixed arrays) need to be added to the reference list

Original comment by evert...@gmail.com on 26 Jun 2009 at 9:27

GoogleCodeExporter commented 8 years ago

Original comment by evert...@gmail.com on 26 Jun 2009 at 9:28

GoogleCodeExporter commented 8 years ago
Please try the trunk version. I believe it will fix your issue

Original comment by evert...@gmail.com on 26 Jun 2009 at 9:33

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Trunk #226 didn't fix the issue.

Content is available only 'till 23:50 CEST, after that time I'll have to test 
with the provided binary data, too. (I 
have no control on the server that provides data)

Original comment by j0t...@gmail.com on 26 Jun 2009 at 9:49

GoogleCodeExporter commented 8 years ago
Are you getting the exact same error? 

This is my test script:

{{{
<?php

require_once 'SabreAMF/Message.php';

$stream = new SabreAMF_InputStream(file_get_contents('data.out'));
$message = new SabreAMF_Message();
$message->deserialize($stream);

print_r($message);

?>
}}}

Original comment by evert...@gmail.com on 26 Jun 2009 at 10:00

GoogleCodeExporter commented 8 years ago
trunk #227 works!

Original comment by j0t...@gmail.com on 26 Jun 2009 at 10:06

GoogleCodeExporter commented 8 years ago
Also, make absolutely sure you are running the trunk version. I've had a case 
once
where I had SabreAMF installed as a PEAR lib, and in a relative directory. Due 
to the
order of include_path the PEAR version got picked

Original comment by evert...@gmail.com on 26 Jun 2009 at 10:06

GoogleCodeExporter commented 8 years ago
Yes, that was what happened: I had release version in the SabreAMF directory, 
and trunk in SabreAMF2. In the 
test script I required SabreAMF2/Message.php, but internal require instructions 
in the SabreAMF library caused it 
to load all files other than Message.php from the SabreAMF directory, so it 
loaded the new Message.php but the 
old other files :)

Original comment by j0t...@gmail.com on 26 Jun 2009 at 10:16

GoogleCodeExporter commented 8 years ago

Original comment by evert...@gmail.com on 27 Jun 2009 at 10:40