ftfy: capture unicode encode errors (#8226)

fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50062
This commit is contained in:
DavidKorczynski 2022-08-12 09:50:10 +01:00 committed by GitHub
parent 84ffe92c14
commit 65e2d97a6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -35,6 +35,8 @@ def TestInput(data):
f.close()
ftfy.guess_bytes(fdp.ConsumeBytes(100))
except UnicodeEncodeError as e2:
pass
except UnicodeError as e:
if "Hey wait, this isn't Unicode." not in str(e):
raise e