Sfoglia il codice sorgente

Fixed bug reported on tack-devel mailing list on 20-3-2011

cjhjacobs 13 anni fa
parent
commit
67cda9e22f
1 ha cambiato i file con 7 aggiunte e 1 eliminazioni
  1. 7 1
      util/ass/ass80.c

+ 7 - 1
util/ass/ass80.c

@@ -189,7 +189,13 @@ cons_t xgetarb(l,f) int l; FILE *f ; {
 
 	shift=0 ; val=0 ;
 	while ( l-- ) {
-		val += ((cons_t)(c = ctrunc(xgetc(f))))<<shift ;
+		// val += ((cons_t)(c = ctrunc(xgetc(f))))<<shift ;
+		// Bug here: shifts with too large shift counts
+		// get unspecified results. --Ceriel
+		c = ctrunc(xgetc(f));
+		if (shift < 8 * sizeof(cons_t)) {
+			val += ((cons_t)c)<<shift ;
+		}
 		shift += 8 ;
 	}
 	if (c == 0377 && shift > 8 && ((shift>>3)&1)) {