* Fixed bug with crash of server on some values of read_rnd_buffer_size (Bug #5492)

This commit is contained in:
brad 2004-10-20 08:09:36 +00:00
parent ce8889672c
commit fc486884a3
2 changed files with 34 additions and 3 deletions

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-include_my_global_h,v 1.1 2004/07/18 11:38:23 espie Exp $
--- include/my_global.h.orig Sun Jul 18 13:06:35 2004
+++ include/my_global.h Sun Jul 18 13:07:13 2004
$OpenBSD: patch-include_my_global_h,v 1.2 2004/10/20 08:09:36 brad Exp $
--- include/my_global.h.orig Thu May 13 20:53:17 2004
+++ include/my_global.h Wed Oct 20 04:02:16 2004
@@ -43,6 +43,10 @@
#define HAVE_ERRNO_AS_DEFINE
#endif /* __CYGWIN__ */
@ -12,3 +12,19 @@ $OpenBSD: patch-include_my_global_h,v 1.1 2004/07/18 11:38:23 espie Exp $
#if defined(i386) && !defined(__i386__)
#define __i386__
#endif
@@ -891,7 +895,14 @@ typedef char bool; /* Ordinary boolean
(((uint32) ((uchar) (A)[1])) << 8) +\
(((uint32) ((uchar) (A)[2])) << 16))
#else
-#define uint3korr(A) (long) (*((unsigned long *) (A)) & 0xFFFFFF)
+
+/*
+ ATTENTION !
+
+ Please, note, uint3korr reads 4 bytes (not 3) !
+ It means, that you have to provide enough allocated space !
+*/
+#define uint3korr(A) (long) (*((unsigned int *) (A)) & 0xFFFFFF)
#endif
#define uint4korr(A) (*((unsigned long *) (A)))
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-sql_records_cc,v 1.1 2004/10/20 08:09:36 brad Exp $
--- sql/records.cc.orig Wed Oct 20 04:00:01 2004
+++ sql/records.cc Wed Oct 20 04:00:44 2004
@@ -249,9 +249,10 @@ static int init_rr_cache(READ_RECORD *in
rec_cache_size=info->cache_records*info->reclength;
info->rec_cache_size=info->cache_records*info->ref_length;
+ // We have to allocate one more byte to use uint3korr (see comments for it)
if (info->cache_records <= 2 ||
!(info->cache=(byte*) my_malloc_lock(rec_cache_size+info->cache_records*
- info->struct_length,
+ info->struct_length+1,
MYF(0))))
DBUG_RETURN(1);
#ifdef HAVE_purify