From 0571a8b1c77886ad9a1ec8c5de4c22e5d1ad18c1 Mon Sep 17 00:00:00 2001 From: David Shea Date: Jan 31 2019 12:28:01 +0000 Subject: Use valid images for the test PNG and GIF data Replace the data in make_png() and make_gif() with small but valid images from https://github.com/mathiasbynens/small In the case of PNG in particular, the file command now returns "data" for a PNG header with no IHDR chunk. The new test data allows make_png to output files that are still recognizable as PNG. --- diff --git a/rpmfluff.py b/rpmfluff.py index 28f6182..a931468 100644 --- a/rpmfluff.py +++ b/rpmfluff.py @@ -227,10 +227,14 @@ class BytesAt(FileConstraint): dstFile.write(self.values) def make_png(): - return [BytesAt(0, b"\x89PNG\x0d\x0a\x1a\x0a")] + return [BytesAt(0, b"\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52" + b"\x00\x00\x00\x01\x00\x00\x00\x01\x08\x06\x00\x00\x00\x1f\x15\xc4" + b"\x89\x00\x00\x00\x0a\x49\x44\x41\x54\x78\x9c\x63\x00\x01\x00\x00" + b"\x05\x00\x01\x0d\x0a\x2d\xb4\x00\x00\x00\x00\x49\x45\x4e\x44\xae" + b"\x42\x60\x82")] def make_gif(): - return [BytesAt(0, b"GIF8")] + return [BytesAt(0, b"GIF89a\x01\x00\x01\x00\x00\x00\x00\x3b")] def make_elf(bit_format=64): """