Mercurial > projects > dwt-win
changeset 302:555d58850cd9
Omit array bounds checking on dynamic struct length.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Fri, 29 Aug 2008 04:26:26 +0200 |
parents | 244e3774d515 |
children | eddc0e013cb8 |
files | dwt/graphics/Image.d |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/dwt/graphics/Image.d Thu Aug 28 15:57:57 2008 +0200 +++ b/dwt/graphics/Image.d Fri Aug 29 04:26:26 2008 +0200 @@ -12,7 +12,7 @@ *******************************************************************************/ module dwt.graphics.Image; - +import tango.util.log.Trace; import dwt.DWT; import dwt.DWTError; import dwt.DWTException; @@ -712,10 +712,11 @@ RGB[] rgbs = new RGB[colorPalette.Count]; paletteData = new PaletteData(rgbs); for (int i = 0; i < colorPalette.Count; i++) { - if (((palette.Entries[i] >> 24) & 0xFF) is 0 && (colorPalette.Flags & Gdip.PaletteFlagsHasAlpha) !is 0) { + // DWT: access palette.Entries without array bounds checking + if (((*(palette.Entries.ptr + i) >> 24) & 0xFF) is 0 && (colorPalette.Flags & Gdip.PaletteFlagsHasAlpha) !is 0) { transparentPixel = i; } - rgbs[i] = new RGB(((palette.Entries[i] & 0xFF0000) >> 16), ((palette.Entries[i] & 0xFF00) >> 8), ((palette.Entries[i] & 0xFF) >> 0)); + rgbs[i] = new RGB(((*(palette.Entries.ptr + i) & 0xFF0000) >> 16), ((*(palette.Entries.ptr + i) & 0xFF00) >> 8), ((*(palette.Entries.ptr + i) & 0xFF) >> 0)); } OS.HeapFree(hHeap, 0, palette); break;