Changeset cae9947 in subsurface for qt-models


Ignore:
Timestamp:
Apr 29, 2016, 9:07:59 AM (18 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
android_test, master
Children:
2e6588d
Parents:
56ed3f1
git-author:
Lubomir I. Ivanov <neolit123@…> (04/28/16 07:33:05)
git-committer:
Dirk Hohndel <dirk@…> (04/29/16 09:07:59)
Message:

CylindersModel?: clamp the "cylinderuse" values

If the value for "use" is negative or larger than the number of
elements in "enum cylinderuse", later CylindersModel::data() can
request a string in the lines of cylinderuse_text[cyl->cylinder_use],
which can SIGSEGV.

Signed-off-by: Lubomir I. Ivanov <neolit123@…>
Signed-off-by: Dirk Hohndel <dirk@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • qt-models/cylindermodel.cpp

    r7be962b rcae9947  
    274274        case USE:
    275275                if (CHANGED()) {
    276                         cyl->cylinder_use = (enum cylinderuse)vString.toInt();
     276                        int use = vString.toInt();
     277                        if (use > NUM_GAS_USE - 1 || use < 0)
     278                                use = 0;
     279                        cyl->cylinder_use = (enum cylinderuse)use;
    277280                        changed = true;
    278281                }
Note: See TracChangeset for help on using the changeset viewer.