From 3f7fc55c7e9db0117235bfd831a33c3776cc93dc Mon Sep 17 00:00:00 2001 From: uz Date: Mon, 9 Aug 2010 15:52:23 +0000 Subject: [PATCH] Added some more checks and initialization. git-svn-id: svn://svn.cc65.org/cc65/trunk@4800 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/dbginfo/dbginfo.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/dbginfo/dbginfo.c b/src/dbginfo/dbginfo.c index 7b35224b0..f6a201ade 100644 --- a/src/dbginfo/dbginfo.c +++ b/src/dbginfo/dbginfo.c @@ -54,7 +54,7 @@ /* Version numbers of the debug format we understand */ #define VER_MAJOR 1U -#define VER_MINOR 0U +#define VER_MINOR 0U /* Dynamic strings */ typedef struct StrBuf StrBuf; @@ -1663,11 +1663,22 @@ static void ParseSegment (InputData* D) goto ErrorExit; } - /* Check for required information */ + /* Check for required and/or matched information */ if ((InfoBits & ibRequired) != ibRequired) { ParseError (D, CC65_ERROR, "Required attributes missing"); goto ErrorExit; } + InfoBits &= (ibOutputName | ibOutputOffs); + if (InfoBits != ibNone && InfoBits != (ibOutputName | ibOutputOffs)) { + ParseError (D, CC65_ERROR, + "Attributes \"outputname\" and \"outputoffs\" must be paired"); + goto ErrorExit; + } + + /* Fix OutputOffs if not given */ + if (InfoBits == ibNone) { + OutputOffs = 0; + } /* Create the segment info and remember it */ S = NewSegInfo (&SegName, Id, Start, Size, &OutputName, OutputOffs); -- 2.39.5