Fixed unused store warnings.
@@ -446,6 +446,13 @@ NSC_MESSAGE* nsc_encode_messages(NSC_CONTEXT* context, const BYTE* data,
UINT32 MaxMessageSize;
NSC_MESSAGE* messages;
UINT32 PaddedMaxPlaneSize;
+
+ if (!context || !data || !numMessages)
+ return NULL;
+
+ if (maxDataSize < 1024)
+ return NULL;
+
k = 0;
MaxRegionWidth = 64 * 4;
MaxRegionHeight = 64 * 2;
@@ -458,6 +465,9 @@ NSC_MESSAGE* nsc_encode_messages(NSC_CONTEXT* context, const BYTE* data,
height);
MaxMessageSize = ByteCount[0] + ByteCount[1] + ByteCount[2] + ByteCount[3] + 20;
maxDataSize -= 1024; /* reserve enough space for headers */
+ if (maxDataSize < (*numMessages) * sizeof(NSC_MESSAGE))
+ return NULL;
+
messages = (NSC_MESSAGE*) calloc(*numMessages, sizeof(NSC_MESSAGE));
if (!messages)
