We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
decode.py
1 parent ab60539 commit 148cf5dCopy full SHA for 148cf5d
decode.py
@@ -1,10 +1,21 @@
1
+import encodings
2
+import pkgutil
3
+
4
+ALL_CODECS = sorted(
5
+ name
6
+ for _, name, _ in pkgutil.iter_modules(encodings.__path__)
7
+ if not name.startswith("_") and name != "aliases"
8
+)
9
10
11
def FuzzerRunOne(FuzzerInput):
- half = int(len(FuzzerInput) / 2)
- A = FuzzerInput[:half]
- B = FuzzerInput[half:].decode("utf-8", "replace").strip()
12
+ if len(FuzzerInput) < 2:
13
+ return
14
+ codec = ALL_CODECS[FuzzerInput[0] % len(ALL_CODECS)]
15
+ data = FuzzerInput[1:]
16
try:
- A.decode(B)
17
+ data.decode(codec)
18
except SystemError:
19
raise
- except:
20
+ except Exception:
21
pass
fuzzer-decode.dict
0 commit comments