summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_parse.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c
index c706fc8ae2e..65f7e74e116 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_parse.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c
@@ -51,7 +51,7 @@ tgsi_parse_init(
void
tgsi_parse_free(
- struct tgsi_parse_context *ctx )
+ UNUSED struct tgsi_parse_context *ctx )
{
}
@@ -59,8 +59,12 @@ boolean
tgsi_parse_end_of_tokens(
struct tgsi_parse_context *ctx )
{
- return ctx->Position >=
- ctx->FullHeader.Header.HeaderSize + ctx->FullHeader.Header.BodySize;
+ /* All values involved are unsigned, but the sum will be promoted to
+ * a signed value (at least on 64 bit). To capture a possible overflow
+ * make it a signed comparison.
+ */
+ return (int)ctx->Position >=
+ ctx->FullHeader.Header.HeaderSize + ctx->FullHeader.Header.BodySize;
}