summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2018-10-11 21:37:45 -0400
committerBehdad Esfahbod <behdad@behdad.org>2018-10-12 16:06:39 -0400
commite9f9c0d81c73d8b6d87700aadb5b886bd289769a (patch)
treed5f29848880d1069bfdec2acbbf0997513764105
parent1a6b5ac6c300ed2ccdcd8eadde433120f6e07f2a (diff)
[sanitize] Reorder condition to silence bogus gcc warning
Was givin a dozen of: ../../src/hb-machinery.hh: In member function ‘bool AAT::ankr::sanitize(hb_sanitize_context_t*) const’: ../../src/hb-machinery.hh:307:23: warning: missed loop optimization, the loop counter may overflow [-Wunsafe-loop-optimizations] bool ok = --this->max_ops > 0 && ~~~~~~~~~~~~~~~~~~~~~~ this->start <= p && ~~~~~~~~~~~~~~~~~~~ p <= this->end && ~~~~~~~~~~~~~~~^~ (unsigned int) (this->end - p) >= len; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I believe those are bogus, but this silences them and does not introduce logic issues I believe.
-rw-r--r--src/hb-machinery.hh6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index 56914bea..a6ff6e7b 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -302,10 +302,10 @@ struct hb_sanitize_context_t :
inline bool check_range (const void *base, unsigned int len) const
{
const char *p = (const char *) base;
- bool ok = this->max_ops-- > 0 &&
- this->start <= p &&
+ bool ok = this->start <= p &&
p <= this->end &&
- (unsigned int) (this->end - p) >= len;
+ (unsigned int) (this->end - p) >= len &&
+ this->max_ops-- > 0;
DEBUG_MSG_LEVEL (SANITIZE, p, this->debug_depth+1, 0,
"check_range [%p..%p] (%d bytes) in [%p..%p] -> %s",