Skip to content
/ wix Public

Commit 98bf1e7

Browse files
committed
Throw compile error if IIS CacheControlMaxAge happens to be authored as
MSI_NULL_INTEGER value Signed-off-by: Bevan Weiss <bevan.weiss@gmail.com>
1 parent 35aa926 commit 98bf1e7

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/api/wix/WixToolset.Data/ErrorMessages.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2271,6 +2271,11 @@ public static Message OverlengthTableNameInProductOrMergeModule(SourceLineNumber
22712271
return Message(sourceLineNumbers, Ids.OverlengthTableNameInProductOrMergeModule, "The table name '{0}' is invalid because the table name exceeds 31 characters in length. For more information, see: https://learn.microsoft.com/en-au/windows/win32/msi/table-names", tableName);
22722272
}
22732273

2274+
public static Message IllegalMsiUnsignedIntegerValue(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string value)
2275+
{
2276+
return Message(sourceLineNumbers, Ids.IllegalMsiUnsignedIntegerValue, "The {0}/@{1} attribute's value, '{2}', is not a legal MSI unsigned integer value. Legal MSI unsigned integer values are from 0 to 2,147,483,647, or 2,147,483,649 to 4,294,967,295", elementName, attributeName, value);
2277+
}
2278+
22742279
private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args)
22752280
{
22762281
return new Message(sourceLineNumber, MessageLevel.Error, (int)id, format, args);
@@ -2672,7 +2677,8 @@ public enum Ids
26722677
MsiTransactionInvalidPackage2 = 412,
26732678
ExpectedAttributeOrElementWithOtherAttribute = 413,
26742679
ExpectedAttributeOrElementWithoutOtherAttribute = 414,
2675-
OverlengthTableNameInProductOrMergeModule = 415
2680+
OverlengthTableNameInProductOrMergeModule = 415,
2681+
IllegalMsiUnsignedIntegerValue = 416
26762682
}
26772683
}
26782684
}

src/ext/Iis/wixext/IIsCompiler.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,6 +1394,10 @@ private string ParseWebDirPropertiesElement(Intermediate intermediate, Intermedi
13941394
break;
13951395
case "CacheControlMaxAge":
13961396
cacheControlMaxAge = this.ParseHelper.GetAttributeLongValue(sourceLineNumbers, attrib, 0, uint.MaxValue); // 4294967295 (uint.MaxValue) represents unlimited
1397+
if (cacheControlMaxAge == 0x8000_0000)
1398+
{
1399+
this.Messaging.Write(ErrorMessages.IllegalMsiUnsignedIntegerValue(sourceLineNumbers, element.Name.LocalName, "CacheControlMaxAge", cacheControlMaxAge.ToString()));
1400+
}
13971401
break;
13981402
case "ClearCustomError":
13991403
notCustomError = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib);

0 commit comments

Comments
 (0)