Previous 199869 Revisions Next

r31440 Sunday 27th July, 2014 at 20:05:44 UTC by Wilbert Pol
gb_lcd.c: Prevent some out of bound array accesses (nw)
[src/mess/video]gb_lcd.c

trunk/src/mess/video/gb_lcd.c
r31439r31440
11861186         case 0x00:                 /* priority is not set (overlaps bgnd & wnd, don't flip x) */
11871187            for (bit = 0; bit < 8; bit++, xindex++)
11881188            {
1189               register int colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0);
1190               if ((m_bg_zbuf[xindex] & 0x80) && (m_bg_zbuf[xindex] & 0x7f) && (LCDCONT & 0x1))
1191                  colour = 0;
1192               if (colour && xindex >= 0 && xindex < 160)
1189               if (xindex >= 0 && xindex < 160)
11931190               {
1194                  if (!m_gbc_mode)
1195                     colour = pal ? m_gb_spal1[colour] : m_gb_spal0[colour];
1196                  plot_pixel(bitmap, xindex, yindex, m_cgb_spal[pal + colour]);
1191                  register int colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0);
1192                  if ((m_bg_zbuf[xindex] & 0x80) && (m_bg_zbuf[xindex] & 0x7f) && (LCDCONT & 0x1))
1193                     colour = 0;
1194                  if (colour)
1195                  {
1196                     if (!m_gbc_mode)
1197                        colour = pal ? m_gb_spal1[colour] : m_gb_spal0[colour];
1198                     plot_pixel(bitmap, xindex, yindex, m_cgb_spal[pal + colour]);
1199                  }
11971200               }
11981201               data <<= 1;
11991202            }

Previous 199869 Revisions Next


© 1997-2024 The MAME Team