java: Unpickler should handle `Opcodes.OBJ`
See original GitHub issueCame 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:
- Created 7 years ago
- Comments:6 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@irmen I can confirm that Pyrolite
4.17-SNAPSHOT
addresses my current needs completely - there is no need for subclassingUnpickler
anymore, and my test suite (involves unpickling ~100 rather complex data structures) passes cleanly.Never had any problems with Pyrolite. Awesome work!
new version 4.17 has been pushed