--- a/mojoshader.c Fri Mar 12 19:51:04 2010 -0500
+++ b/mojoshader.c Wed Mar 24 09:56:34 2010 -0400
@@ -6709,6 +6709,7 @@
else // geometry shader? Bogus data?
{
fail(ctx, "Unsupported shader type or not a shader at all");
+ return -1;
} // else
ctx->major_ver = major;
@@ -7676,6 +7677,15 @@
ctx->parse_phase = MOJOSHADER_PARSEPHASE_WORKING;
rc = parse_version_token(ctx, profile);
+ // drop out now if this definitely isn't bytecode. Saves lots of
+ // meaningless errors flooding through.
+ if (rc < 0)
+ {
+ retval = build_parsedata(ctx);
+ destroy_context(ctx);
+ return retval;
+ } // if
+
if ( ((uint32) rc) > ctx->tokencount )
{
fail(ctx, "Corrupted or truncated shader");