diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2010-11-24 07:00:20 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2010-11-24 07:00:20 (GMT) |
commit | fe8276e812c5fdc690715d7e36a6b6d70cba7d33 (patch) | |
tree | f899ea57702fdb78e2a57d4107d84651c65a3957 /src | |
parent | d0f74ae9712b2225c12c95891357c5f93c30996c (diff) | |
download | Qt-fe8276e812c5fdc690715d7e36a6b6d70cba7d33.zip Qt-fe8276e812c5fdc690715d7e36a6b6d70cba7d33.tar.gz Qt-fe8276e812c5fdc690715d7e36a6b6d70cba7d33.tar.bz2 |
Prevent compilers optimizing eval timebomb code out of existence.
The variable that holds the eval license key is a placeholder that is
patched during package installation. Unfortunately, for a non-final
package build, the placeholder is filled with nulls at compile-time and
a clever compiler will optimize away most of the eval timebomb code due
to a check in the eval code for the first character of the license key
being null.
This commit makes the variable that holds the license key volatile, to
convince compilers that they cannot make assumptions about the contents
of the variable when optimizing.
Task-number: QT-3848
Acked-by: Thiago Macieira
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qtcore_eval.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/kernel/qtcore_eval.cpp b/src/corelib/kernel/qtcore_eval.cpp index 78556c3..da76b74 100644 --- a/src/corelib/kernel/qtcore_eval.cpp +++ b/src/corelib/kernel/qtcore_eval.cpp @@ -90,14 +90,14 @@ static const char will_shutdown_now[] = static int qt_eval_is_supported() { - const char *const license_key = qt_eval_key_data + 12; + const volatile char *const license_key = qt_eval_key_data + 12; // fast fail if (!qt_eval_key_data[0] || !*license_key) return -1; // is this an unsupported evaluation? - const char* typecode = license_key; + const volatile char *typecode = license_key; int field = 2; for ( ; field && *typecode; ++typecode) if (*typecode == '-') |