summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc21
1 files changed, 12 insertions, 9 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 9a3c7589db2..ec5740cf3e2 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -31,10 +31,10 @@
#pragma implementation // gcc: Class implementation
#endif
-/* May include caustic 3rd-party defs. Use early, so it can override nothing. */
-#include "sha2.h"
-#include "my_global.h" // HAVE_*
+#include <my_global.h> // HAVE_*
+/* May include caustic 3rd-party defs. Use early, so it can override nothing */
+#include "sha2.h"
#include "sql_priv.h"
/*
@@ -1378,12 +1378,15 @@ bool Item_func_regexp_replace::append_replacement(String *str,
break; /* End of line */
beg+= cnv;
- if ((n= ((int) wc) - '0') >= 0 && n <= 9 && n < re.nsubpatterns())
+ if ((n= ((int) wc) - '0') >= 0 && n <= 9)
{
- /* A valid sub-pattern reference found */
- int pbeg= re.subpattern_start(n), plength= re.subpattern_end(n) - pbeg;
- if (str->append(source->str + pbeg, plength, cs))
- return true;
+ if (n < re.nsubpatterns())
+ {
+ /* A valid sub-pattern reference found */
+ int pbeg= re.subpattern_start(n), plength= re.subpattern_end(n) - pbeg;
+ if (str->append(source->str + pbeg, plength, cs))
+ return true;
+ }
}
else
{
@@ -4191,7 +4194,7 @@ String *Item_func_uncompress::val_str(String *str)
goto err;
if ((err= uncompress((Byte*)buffer.ptr(), &new_size,
- ((const Bytef*)res->ptr())+4,res->length())) == Z_OK)
+ ((const Bytef*)res->ptr())+4,res->length()-4)) == Z_OK)
{
buffer.length((uint32) new_size);
return &buffer;