diff options
author | guilhem@mysql.com <> | 2005-11-07 16:18:46 +0100 |
---|---|---|
committer | guilhem@mysql.com <> | 2005-11-07 16:18:46 +0100 |
commit | ef415ceb14b2b43178a2a555d14a0764dfda1b31 (patch) | |
tree | 7b70cea20c3b819b996a804ba53efafcba9e279a /sql/field.cc | |
parent | 517e51f1ed4bda8600c1f8c2ca11da224b4cb68d (diff) | |
download | mariadb-git-ef415ceb14b2b43178a2a555d14a0764dfda1b31.tar.gz |
Fix for BUG#14703 "Valgrind error when inserting 0 into a BIT column (like in type_bit.test)":
test "length" first (otherwise when "length" is 0, the *from invalid access still triggers a Valgrind warning).
I wrote to the Valgrind authors in case this is something fixable in Valgrind (normally the
decision to issue a warning is based on the simulated CPU condition code, which should not be undefined here).
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/field.cc b/sql/field.cc index 03d20b4bfe2..18ef77230f2 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -7931,7 +7931,7 @@ int Field_bit::store(const char *from, uint length, CHARSET_INFO *cs) { int delta; - for (; !*from && length; from++, length--); // skip left 0's + for (; length && !*from; from++, length--); // skip left 0's delta= field_length - length; if (delta < -1 || @@ -8151,7 +8151,7 @@ int Field_bit_as_char::store(const char *from, uint length, CHARSET_INFO *cs) int delta; uchar bits= create_length & 7; - for (; !*from && length; from++, length--); // skip left 0's + for (; length && !*from; from++, length--); // skip left 0's delta= field_length - length; if (delta < 0 || |