Corrupt generic signatures lead to incorrect class super types/interfaces, field types, and method parameter/variable types #409
Labels
Priority: Low
Low priority
Subsystem: Generics
Anything concerning how generics are decompiled
Type: Bug
Something isn't working
Vineflower version
1.10.1
Describe the bug
If generic signatures are present, Vineflower replaces the corresponding types with those in the signatures, without verifying that they are the same.
Additional information
For example, take the following class
The class
Signatures
has interfacejava/util/List
and signatureLjava/lang/Object;Ljava/util/List<Ljava/lang/String;>;
.The field
field
has descriptorLjava/util/List;
and signatureLjava/util/List<Ljava/lang/String;>;
.The method
method
has descriptor(Ljava/util/List;)V
and signatureLjava/util/List<Ljava/lang/String;>;
.Now if we corrupt the class file by changing only the signatures, as follows:
Change the class signature to
Ljava/lang/Object;Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;
.Change the field signature to
Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;
.Change the method signature to
(Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;)V
.This corrupted class file will decompile to
Notice that the class interface, field descriptor, and method descriptor all changed, while those were not modified in the class file at all.
In situations like this Vineflower ought to ignore corrupted signatures rather than corrupting other code with it.
Here's the class files I tested with:
uncorrupted class file
corrupted class file
The text was updated successfully, but these errors were encountered: