~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/check_stack_overrun.cc

Replace MAX_(DATE|TIME).*_WIDTH defines in definitions.h with real (and correct) static const members to Temporal types.

This fixes the buffer overflow in https://bugs.launchpad.net/drizzle/+bug/373468

It also removes a handwritten snprintf in field/datetime.cc
However... this caused us to have to change Temporal to have a way to not
"convert" the int64_t value (so 20090101 becomes 20090101000000 etc) as it
has already been converted and we just want the Temporal type to do the
to_string conversion.

This still causes a failure in 'metadata' test due to size of timestamp type. I need feedback from Jay on when the usecond code comes into play to know the correct fix for this.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
21
 
#include "drizzled/internal/my_sys.h"
 
20
#include <drizzled/global.h>
 
21
#include <mysys/my_sys.h>
22
22
#include <drizzled/definitions.h>
23
23
#include <drizzled/session.h>
24
24
#include <drizzled/error.h>
25
 
#include <drizzled/check_stack_overrun.h>
26
 
 
27
 
namespace drizzled
28
 
{
29
25
 
30
26
/****************************************************************************
31
27
        Check stack size; Send error if there isn't enough stack to continue
32
28
****************************************************************************/
33
 
#if defined(STACK_DIRECTION) && (STACK_DIRECTION < 0)
 
29
#if STACK_DIRECTION < 0
34
30
#define used_stack(A,B) (long) (A - B)
35
31
#else
36
32
#define used_stack(A,B) (long) (B - A)
52
48
  }
53
49
  return false;
54
50
}
55
 
 
56
 
} /* namespace drizzled */