Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

list index out of range #11

Open
HellishBro opened this issue Jul 23, 2023 · 2 comments
Open

list index out of range #11

HellishBro opened this issue Jul 23, 2023 · 2 comments

Comments

@HellishBro
Copy link

last line says result = self.objects[link_id]

file
rubymarshal/reader.py line 169

@HellishBro
Copy link
Author

i made a workaround by commenting deleting the whole if token in tuple thing and just moved its inner statements out

@mdellweg
Copy link

I receive the same error when trying to decode this stream:
(hex)

0408753a1747656d3a3a53706563696669636174696f6e01d004085b17220a312e332e376908220661553a1147656d3a3a56657273696f6e5b06220a302e312e3049753a0954696d650d70931b8000000000063a1f406d61727368616c5f776974685f7574635f636f657263696f6e46220c53756d6d617279553a1547656d3a3a526571756972656d656e745b065b065b0722073e3d553b005b06220630553b085b065b065b0722073e3d553b005b062206302209727562795b0030220b20456d61696c5b06220c20417574686f7222002216687474703a2f2f676f6f676c652e636f6d54401d5b00

(bytes)

b'\x04\x08u:\x17Gem::Specification\x01\xd0\x04\x08[\x17"\n1.3.7i\x08"\x06aU:\x11Gem::Version[\x06"\n0.1.0Iu:\tTime\rp\x93\x1b\x80\x00\x00\x00\x00\x06:\x1f@marshal_with_utc_coercionF"\x0cSummaryU:\x15Gem::Requirement[\x06[\x06[\x07"\x07>=U;\x00[\x06"\x060U;\x08[\x06[\x06[\x07"\x07>=U;\x00[\x06"\x060"\truby[\x000"\x0b Email[\x06"\x0c Author"\x00"\x16http://google.comT@\x1d[\x00'

Gem::Specification is a UsrDef type and it uses Marshal.dump/load to stream its private data which looks like this:

b'\x04\x08[\x17"\n1.3.7i\x08"\x06aU:\x11Gem::Version[\x06"\n0.1.0Iu:\tTime\rp\x93\x1b\x80\x00\x00\x00\x00\x06:\x1f@marshal_with_utc_coercionF"\x0cSummaryU:\x15Gem::Requirement[\x06[\x06[\x07"\x07>=U;\x00[\x06"\x060U;\x08[\x06[\x06[\x07"\x07>=U;\x00[\x06"\x060"\truby[\x000"\x0b Email[\x06"\x0c Author"\x00"\x16http://google.comT@\x1d[\x00'

The @\x1d throws the out of range error. The same thing decodes fine with Ruby's Marshal.load. I assume that recursive Marshal.load/dump calls are allowed to share the list of objects to link to. (Non obvious from the code there.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants