question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java: Unpickler should handle `Opcodes.OBJ`

See original GitHub issue

Came across this issue when unpickling “callable class” instances.

By observing Python2.7 and Python 3.4 pickle.py files, I’ve managed to provide a temporary handler like this:

Unpickler unpickler = new Unpickler(){

	@Override
	protected Object dispatch(short key) throws IOException {
		switch(key){
			case Opcodes.OBJ:
				return load_obj();
			default:
				return super.dispatch(key);
		}
	}

	private Object load_obj(){
		List<Object> args = super.stack.pop_all_since_marker();
		IObjectConstructor constructor = (IObjectConstructor)args.get(0);
		args = args.subList(1, args.size());
		Object object = constructor.construct(args.toArray());
		super.stack.add(object);

		return noReturnValue();
	}
};

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
vruusmanncommented, Feb 2, 2017

@irmen I can confirm that Pyrolite 4.17-SNAPSHOT addresses my current needs completely - there is no need for subclassing Unpickler anymore, and my test suite (involves unpickling ~100 rather complex data structures) passes cleanly.

Never had any problems with Pyrolite. Awesome work!

0reactions
irmencommented, Feb 2, 2017

new version 4.17 has been pushed

Read more comments on GitHub >

github_iconTop Results From Across the Web

net.razorvine.pickle.Unpickler java code examples - Tabnine
Best Java code snippets using net.razorvine.pickle. ... static private Object readObject(InputStream is) throws IOException { Unpickler unpickler = new ...
Read more >
pickle — Python object serialization - GeeksforGeeks
The pickle module is used for implementing binary protocols for serializing and de-serializing a Python object structure.
Read more >
Dangerous Pickles — Malicious Python Serialization - Intoli
We'll pickle and unpickle the object with ... This method removes unused opcodes from the pickle, so it will produce a simpler—but otherwise ......
Read more >
11.1. pickle — Python object serialization - Python 3.2 Documentation
Pickling (and unpickling) is alternatively known as “serialization”, ... The pickle module can transform a complex object into a byte stream and it...
Read more >
Chapter 6. The Java Virtual Machine Instruction Set
A Java Virtual Machine instruction consists of an opcode specifying the ... The objectref must be of type reference and must refer to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found