chiark / gitweb /
only allow ordinary parsing of pic cmds if length and terminator match
authorian <ian>
Tue, 15 Jan 2008 22:32:49 +0000 (22:32 +0000)
committerian <ian>
Tue, 15 Jan 2008 22:32:49 +0000 (22:32 +0000)
hostside/skelproto-pic.c

index 0808ba6b9d18fc859bc158e7ff1bc27aa0c1bb34..31895b2e84a979aad94583c3d4f24fb40f69b973 100644 (file)
@@ -58,7 +58,7 @@ void picinsn_decode(const PicInsn *pi, const PicInsnInfo *table,
     if (pii->argbits <= 6) {
       if (pi->l != 1) pii= 0;
     } else {
-      if (pi->l == 2) { val <<= 7; val |= pi->d[1]; }
+      if (pi->l == 2 && !(pi->d[1] & 0x80u)) { val <<= 7; val |= pi->d[1]; }
       else pii= 0;
     }
   }