mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-08-09 10:39:11 +02:00
Reject non-PNG signature export data (#1651)
This commit is contained in:
parent
d697328cf8
commit
2858871d07
2 changed files with 17 additions and 2 deletions
|
|
@ -34,9 +34,12 @@ def _decode_png_data(data_png: str) -> bytes:
|
|||
if "," in raw:
|
||||
raw = raw.split(",", 1)[1]
|
||||
try:
|
||||
return base64.b64decode(raw, validate=True)
|
||||
decoded = base64.b64decode(raw, validate=True)
|
||||
except Exception as e:
|
||||
fail(f"data_png is not valid base64: {e}")
|
||||
if not decoded.startswith(b"\x89PNG\r\n\x1a\n"):
|
||||
fail("data_png is not a PNG image")
|
||||
return decoded
|
||||
|
||||
|
||||
def cmd_list(args):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue