mirror of
https://github.com/Guardsquare/proguard.git
synced 2026-03-13 09:50:34 +08:00
Limit size of strings to 65535 bytes
This commit is contained in:
@@ -31,6 +31,7 @@ import proguard.configuration.InitialStateInfo;
|
||||
import proguard.evaluation.IncompleteClassHierarchyException;
|
||||
import proguard.logging.Logging;
|
||||
import proguard.mark.Marker;
|
||||
import proguard.normalize.StringNormalizer;
|
||||
import proguard.obfuscate.NameObfuscationReferenceFixer;
|
||||
import proguard.obfuscate.ObfuscationPreparation;
|
||||
import proguard.obfuscate.Obfuscator;
|
||||
@@ -219,6 +220,7 @@ public class ProGuard
|
||||
configuration.obfuscate)
|
||||
{
|
||||
expandPrimitiveArrayConstants();
|
||||
normalizeStrings();
|
||||
}
|
||||
|
||||
if (configuration.targetClassVersion != 0)
|
||||
@@ -269,6 +271,11 @@ public class ProGuard
|
||||
}
|
||||
}
|
||||
|
||||
private void normalizeStrings() throws Exception {
|
||||
passRunner.run(new StringNormalizer(),appView);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks the GPL.
|
||||
|
||||
22
base/src/main/java/proguard/normalize/StringNormalizer.java
Normal file
22
base/src/main/java/proguard/normalize/StringNormalizer.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package proguard.normalize;
|
||||
|
||||
import proguard.AppView;
|
||||
import proguard.classfile.visitor.ParallelAllClassVisitor;
|
||||
import proguard.pass.Pass;
|
||||
import proguard.pass.PassId;
|
||||
|
||||
/**
|
||||
* Ensures all strings are at most 65535 bytes in length, when encoded as modified UTF-8.
|
||||
*
|
||||
* @see LargeStringSplitter
|
||||
*/
|
||||
public class StringNormalizer implements Pass {
|
||||
|
||||
|
||||
@Override
|
||||
public void execute(AppView appView) throws Exception {
|
||||
appView.programClassPool.accept(
|
||||
new ParallelAllClassVisitor(
|
||||
() -> new LargeStringSplitter(appView.programClassPool, appView.libraryClassPool)));
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,10 @@
|
||||
|
||||
## Version 7.6.2
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- Prevent `IllegalArgumentException` when strings longer than 65535 bytes are present in the application (#267).
|
||||
|
||||
## Version 7.6.1
|
||||
|
||||
### Bugfixes
|
||||
|
||||
Reference in New Issue
Block a user