#At file:///home/satya/WORK/43973/mysql-5.0-bugteam-43973/ based on revid:timothy.smith@stripped
2725 Satya B 2009-04-03
Fix for Bug #43973 - backup_myisam.test fails on 6.0-bugteam
The test started failing following the push for BUG#41541.
The record positions are always increased by the word size and
it started failing when the push for BUG#41541 increased it by
only the number of bytes actually available.
Fixed by allocating seven extra bytes to the Memory segment #2
so that we don't read unallocated memory.
Note: The bug was reported on 6.0 as the test failed but it
affects 5.0-bugteam, 5.1-bugteam branches also.
No testcase added the bug is about test failure.
modified:
myisam/mi_packrec.c
per-file messages:
myisam/mi_packrec.c
Fixed _mi_read_pack_info() method to allocate seven extra bytes in
Memory segment #2
=== modified file 'myisam/mi_packrec.c'
--- a/myisam/mi_packrec.c 2009-03-25 09:15:53 +0000
+++ b/myisam/mi_packrec.c 2009-04-03 08:46:48 +0000
@@ -208,9 +208,13 @@ my_bool _mi_read_pack_info(MI_INFO *info
This segment will be reallocated after construction of the tables.
*/
length=(uint) (elements*2+trees*(1 << myisam_quick_table_bits));
+ /*
+ Allocate 7 extra bytes to avoid valgrind warnings when reading
+ compressed myisam table record into buffer
+ */
if (!(share->decode_tables=(uint16*)
my_malloc((length + OFFSET_TABLE_SIZE) * sizeof(uint16) +
- (uint) (share->pack.header_length - sizeof(header)),
+ (uint) (share->pack.header_length - sizeof(header) + 7),
MYF(MY_WME | MY_ZEROFILL))))
goto err1;
tmp_buff=share->decode_tables+length;
@@ -1430,31 +1434,6 @@ static void fill_buffer(MI_BIT_BUFF *bit
bit_buff->current_byte=0;
return;
}
- else
- {
- uint len= 0;
- uint i= 0;
- /*
- Check if the remaining buffer/record to read is less than the word size.
- If so read byte by byte
-
- Note: if this branch becomes a bottleneck it can be removed, assuming
- that the second memory segment allocates 7 extra bytes (see
- _mi_read_pack_info()).
- */
- len= bit_buff->end - bit_buff->pos;
- if (len < (BITS_SAVED / 8))
- {
- bit_buff->current_byte= 0;
- for (i=0 ; i < len ; i++)
- {
- bit_buff->current_byte+= (((uint) ((uchar) bit_buff->pos[len - i - 1]))
- << (8 * i));
- }
- bit_buff->pos= bit_buff->end;
- return;
- }
- }
#if BITS_SAVED == 64
bit_buff->current_byte= ((((uint) ((uchar) bit_buff->pos[7]))) +