From 3a0d1f300bd3982f8332659270c531ecd8d1f288 Mon Sep 17 00:00:00 2001
From: unknown <evgen@moonbone.local>
Date: Wed, 21 Nov 2007 02:48:01 +0300
Subject: [PATCH] sql_select.cc:   Additional stack check for the bug#31048.

sql/sql_select.cc:
  Additional stack check for the bug#31048.
---
 sql/sql_select.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 3d3b8668a79..e25d0d78c87 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2332,6 +2332,11 @@ static ha_rows get_quick_record_count(THD *thd, SQL_SELECT *select,
 {
   int error;
   DBUG_ENTER("get_quick_record_count");
+#ifndef EMBEDDED_LIBRARY                      // Avoid compiler warning
+  char buff[STACK_BUFF_ALLOC];
+#endif
+  if (check_stack_overrun(thd, STACK_MIN_SIZE, buff))
+    DBUG_RETURN(0);                           // Fatal error flag is set
   if (select)
   {
     select->head=table;
-- 
2.30.9