mirror of https://github.com/OpenTTD/OpenTTD
(svn r24915) -Fix: Several out-of-bounds reads
parent
914bb708ad
commit
3a3162865b
|
@ -163,13 +163,13 @@ static inline bool IsCargoInClass(CargoID c, CargoClass cc)
|
||||||
* @param var Reference getting the cargospec.
|
* @param var Reference getting the cargospec.
|
||||||
* @see CargoSpec
|
* @see CargoSpec
|
||||||
*/
|
*/
|
||||||
#define FOR_ALL_SORTED_CARGOSPECS(var) for (uint8 index = 0; var = _sorted_cargo_specs[index], index < _sorted_cargo_specs_size; index++)
|
#define FOR_ALL_SORTED_CARGOSPECS(var) for (uint8 index = 0; index < _sorted_cargo_specs_size && (var = _sorted_cargo_specs[index], true) ; index++)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loop header for iterating over 'real' cargoes, sorted by name. Phony cargoes like regearing cargoes are skipped.
|
* Loop header for iterating over 'real' cargoes, sorted by name. Phony cargoes like regearing cargoes are skipped.
|
||||||
* @param var Reference getting the cargospec.
|
* @param var Reference getting the cargospec.
|
||||||
* @see CargoSpec
|
* @see CargoSpec
|
||||||
*/
|
*/
|
||||||
#define FOR_ALL_SORTED_STANDARD_CARGOSPECS(var) for (uint8 index = 0; var = _sorted_cargo_specs[index], index < _sorted_standard_cargo_specs_size; index++)
|
#define FOR_ALL_SORTED_STANDARD_CARGOSPECS(var) for (uint8 index = 0; index < _sorted_standard_cargo_specs_size && (var = _sorted_cargo_specs[index], true); index++)
|
||||||
|
|
||||||
#endif /* CARGOTYPE_H */
|
#endif /* CARGOTYPE_H */
|
||||||
|
|
|
@ -200,7 +200,7 @@ struct HighScoreWindow : EndGameHighScoreBaseWindow {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const NWidgetPart _nested_highscore_widgets[] = {
|
static const NWidgetPart _nested_highscore_widgets[] = {
|
||||||
NWidget(WWT_PANEL, COLOUR_END, WID_H_BACKGROUND), SetMinimalSize(641, 481), SetResize(1, 1), EndContainer(),
|
NWidget(WWT_PANEL, COLOUR_BROWN, WID_H_BACKGROUND), SetMinimalSize(641, 481), SetResize(1, 1), EndContainer(),
|
||||||
};
|
};
|
||||||
|
|
||||||
static const WindowDesc _highscore_desc(
|
static const WindowDesc _highscore_desc(
|
||||||
|
|
|
@ -2063,12 +2063,12 @@ class LanguagePackGlyphSearcher : public MissingGlyphSearcher {
|
||||||
{
|
{
|
||||||
if (this->i >= TAB_COUNT) return NULL;
|
if (this->i >= TAB_COUNT) return NULL;
|
||||||
|
|
||||||
const char *ret = _langpack_offs[_langtab_start[i] + j];
|
const char *ret = _langpack_offs[_langtab_start[this->i] + this->j];
|
||||||
|
|
||||||
this->j++;
|
this->j++;
|
||||||
while (this->j >= _langtab_num[this->i] && this->i < TAB_COUNT) {
|
while (this->i < TAB_COUNT && this->j >= _langtab_num[this->i]) {
|
||||||
i++;
|
this->i++;
|
||||||
j = 0;
|
this->j = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -175,6 +175,8 @@ int GetWidgetFromPos(const Window *w, int x, int y)
|
||||||
*/
|
*/
|
||||||
void DrawFrameRect(int left, int top, int right, int bottom, Colours colour, FrameFlags flags)
|
void DrawFrameRect(int left, int top, int right, int bottom, Colours colour, FrameFlags flags)
|
||||||
{
|
{
|
||||||
|
assert(colour < COLOUR_END);
|
||||||
|
|
||||||
uint dark = _colour_gradient[colour][3];
|
uint dark = _colour_gradient[colour][3];
|
||||||
uint medium_dark = _colour_gradient[colour][5];
|
uint medium_dark = _colour_gradient[colour][5];
|
||||||
uint medium_light = _colour_gradient[colour][6];
|
uint medium_light = _colour_gradient[colour][6];
|
||||||
|
|
Loading…
Reference in New Issue