diff options
author | michi_cc <michi_cc@openttd.org> | 2011-09-02 20:16:41 +0000 |
---|---|---|
committer | michi_cc <michi_cc@openttd.org> | 2011-09-02 20:16:41 +0000 |
commit | 65637d89411e96dee5ee9fc2e8a7b3805c4162a2 (patch) | |
tree | 79fdfb3cefba4457d3b81760173c5ca68e359a81 /src/openttd.cpp | |
parent | 6c7cbb1d46d266d33e49bd42a52e483296313882 (diff) | |
download | openttd-65637d89411e96dee5ee9fc2e8a7b3805c4162a2.tar.xz |
(svn r22874) -Fix [FS#4747]: Check size of various buffers before allocation. (monoid)
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r-- | src/openttd.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp index 5cd5eba37..af1f77f4e 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -596,11 +596,12 @@ int ttd_main(int argc, char *argv[]) /* * The width and height must be at least 1 pixel and width times - * height must still fit within a 32 bits integer, this way all - * internal drawing routines work correctly. + * height times bytes per pixel must still fit within a 32 bits + * integer, even for 32 bpp video modes. This way all internal + * drawing routines work correctly. */ - _cur_resolution.width = ClampU(_cur_resolution.width, 1, UINT16_MAX); - _cur_resolution.height = ClampU(_cur_resolution.height, 1, UINT16_MAX); + _cur_resolution.width = ClampU(_cur_resolution.width, 1, UINT16_MAX / 2); + _cur_resolution.height = ClampU(_cur_resolution.height, 1, UINT16_MAX / 2); /* enumerate language files */ InitializeLanguagePacks(); |