[PEAK] checking arbitrary bytecode for potential crashes

PJ Eby pje at telecommunity.com
Tue Sep 30 20:16:29 EDT 2014


On Tue, Sep 30, 2014 at 4:57 AM, Dima Tisnek <dimaqq at gmail.com> wrote:
> Hi all,
>
> BytecodeAssembler mentions that "It should now be virtually impossible
> to accidentally generate bytecode that can crash the interpreter. (If
> you find a way, let me know!)"
>
> How do I invoke this validation?
>
> Here's a simplest example after ned and lvh:
>
> code_obj = peak.util.assembler.code(0, 0, 1, 0, "KABOOM", (), (), (),
> "gooo", "goo", 1, "l")

That doesn't look accidental to me.  That looks like you did it on purpose.  ;-)

To elaborate:

* There is no validation for raw bytecode -- it's Bytecode*Assembler*,
not RawBytecodeVerifier  ;-)
* It's simple stack-level validation and dead-code prevention, not
security validation
* As it says, it's intended to prevent *accidental* crashing code
caused by bugs in your bytecode generation process using the opcode or
AST APIs.

;-)


More information about the PEAK mailing list