diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 190df1b..14201c6 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2970,7 +2970,7 @@ bool Item_func_repeat::fix_length_and_dec()
 
     /* Assumes that the maximum length of a String is < INT_MAX32. */
     /* Set here so that rest of code sees out-of-bound value as such. */
-    if (args[1]->null_value)
+    if (args[1]->null_value || count < 1)
       count= 0;
     else if (count > INT_MAX32)
       count= INT_MAX32;
