qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 17/24] scripts/signrom.py: Check for magic in option


From: Paolo Bonzini
Subject: [Qemu-devel] [PULL 17/24] scripts/signrom.py: Check for magic in option ROMs.
Date: Mon, 23 May 2016 17:09:52 +0200

From: "Richard W.M. Jones" <address@hidden>

Because of the risk that compilers might not emit the asm() block at
the beginning of the option ROM, check that the ROM contains the
required magic signature.

Signed-off-by: Richard W.M. Jones <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
 scripts/signrom.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/signrom.py b/scripts/signrom.py
index 6c8b9bf..5629bca 100644
--- a/scripts/signrom.py
+++ b/scripts/signrom.py
@@ -17,7 +17,10 @@ if len(sys.argv) < 3:
 fin = open(sys.argv[1], 'rb')
 fout = open(sys.argv[2], 'wb')
 
-fin.seek(2)
+magic = fin.read(2)
+if magic != '\x55\xaa':
+    sys.exit("%s: option ROM does not begin with magic 55 aa" % sys.argv[1])
+
 size_byte = ord(fin.read(1))
 fin.seek(0)
 
-- 
1.8.3.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]