]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: add error check for "#image" for idf file format
authorYonghong Zhu <yonghong.zhu@intel.com>
Wed, 30 Nov 2016 09:00:19 +0000 (17:00 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Fri, 2 Dec 2016 03:00:43 +0000 (11:00 +0800)
Add new error check for "#image" keyword used in the image definition
file.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/Python/AutoGen/IdfClassObject.py

index 76bc6d1b931e45e936ba414a3bb52269dba4dbf6..d6d4703370aa79507426afffca5bb2c554ef1070 100644 (file)
@@ -94,9 +94,12 @@ class IdfFileClassObject(object):
             if len(Line) == 0:\r
                 continue\r
 \r
+            LineNo = GetLineNo(FileIn, Line, False)\r
+            if not Line.startswith('#image '):\r
+                EdkLogger.error("Image Definition File Parser", PARSER_ERROR, 'The %s in Line %s of File %s is invalid.' % (Line, LineNo, File.Path))\r
+\r
             if Line.find('#image ') >= 0:\r
                 LineDetails = Line.split()\r
-                LineNo = GetLineNo(FileIn, Line, False)\r
                 Len = len(LineDetails)\r
                 if Len != 3 and Len != 4:\r
                     EdkLogger.error("Image Definition File Parser", PARSER_ERROR, 'The format is not match #image IMAGE_ID [TRANSPARENT] ImageFileName in Line %s of File %s.' % (LineNo, File.Path))\r