~ubuntu-branches/debian/squeeze/openttd/squeeze

« back to all changes in this revision

Viewing changes to src/newgrf_cargo.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Matthijs Kooijman
  • Date: 2008-08-08 11:07:05 UTC
  • mfrom: (1.1.4 upstream) (2.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080808110705-zq0eo95c4pexg70i
* New upstream release.
  - Fixes remote crash vulnerability CVE-2008-3547. Closes: #493714

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: newgrf_cargo.cpp 12142 2008-02-15 10:52:10Z frosch $ */
 
1
/* $Id: newgrf_cargo.cpp 13871 2008-07-29 22:37:54Z rubidium $ */
2
2
 
3
3
#include "stdafx.h"
4
4
#include "openttd.h"
106
106
                /* Else the cargo value is a 'climate independent' 'bitnum' */
107
107
                if (HasBit(_cargo_mask, cargo)) return GetCargoIDByBitnum(cargo);
108
108
        } else {
109
 
                /* If the GRF contains a translation table (and the cargo is in bounds)
110
 
                 * then get the cargo ID for the label */
111
 
                if (cargo < grffile->cargo_max) return GetCargoIDByLabel(grffile->cargo_list[cargo]);
 
109
                /* If the GRF contains a translation table... */
 
110
                if (grffile->cargo_max > 0) {
 
111
                        /* ...and the cargo is in bounds, then get the cargo ID for
 
112
                         * the label */
 
113
                        if (cargo < grffile->cargo_max) return GetCargoIDByLabel(grffile->cargo_list[cargo]);
 
114
                } else {
 
115
                        /* Else the cargo value is a 'climate independent' 'bitnum' */
 
116
                        if (HasBit(_cargo_mask, cargo)) return GetCargoIDByBitnum(cargo);
 
117
                }
112
118
        }
113
119
        return CT_INVALID;
114
120
}