Handle classes with nil superclass.
authorFredrik Tolf <fredrik@dolda2000.com>
Mon, 10 Apr 2023 16:01:47 +0000 (18:01 +0200)
committerFredrik Tolf <fredrik@dolda2000.com>
Mon, 10 Apr 2023 16:01:47 +0000 (18:01 +0200)
Ie. java.lang.Object.

classfile/file.py

index d361b47..819c6a4 100644 (file)
@@ -637,7 +637,7 @@ class classfile(object):
         self.super = buf.uint16()
         if not self.checkcp(self.this, classref):
             raise binfmt.fmterror("invalid class name reference")
-        if not self.checkcp(self.super, classref):
+        if not self.checkcp(self.super, classref) and self.cp[self.super] is not None:
             raise binfmt.fmterror("invalid super-class reference")
         iflen = buf.uint16()
         while len(self.ifaces) < iflen: