Add sanity check panic for CRTC interactions

This commit is contained in:
Nathaniel Wesley Filardo 2015-11-07 00:38:40 -05:00 committed by Frans Kaashoek
parent b019ac4f7d
commit 02530a4859

View file

@ -144,6 +144,9 @@ cgaputc(int c)
} else } else
crt[pos++] = (c&0xff) | 0x0700; // black on white crt[pos++] = (c&0xff) | 0x0700; // black on white
if(pos > 25*80)
panic("pos overflow");
if((pos/80) >= 24){ // Scroll up. if((pos/80) >= 24){ // Scroll up.
memmove(crt, crt+80, sizeof(crt[0])*23*80); memmove(crt, crt+80, sizeof(crt[0])*23*80);
pos -= 80; pos -= 80;