mirror of
https://github.com/MariaDB/server.git
synced 2025-12-28 00:01:00 +00:00
MDEV-35541 UBSAN: runtime error: addition of unsigned offset to X overflowed to Y in my_b_flush_io_cache
Some checks failed
Build on Windows ARM64 / build (push) Has been cancelled
Some checks failed
Build on Windows ARM64 / build (push) Has been cancelled
/home/buildbot/server/mysys/mf_iocache.c:1793:39: runtime error: addition of unsigned offset to 0x7e1586a239fb overflowed to 0x7e1586a239fa SUMMARY: UndefinedBehaviorSanitizer: pointer-overflow /home/buildbot/server/mysys/mf_iocache.c:1793:39
This commit is contained in:
parent
576b4fe4e5
commit
d11c4402e7
@ -212,7 +212,7 @@ int init_io_cache_ext(IO_CACHE *info, File file, size_t cachesize,
|
||||
{
|
||||
size_t min_cache;
|
||||
my_off_t pos;
|
||||
my_off_t end_of_file= ~(my_off_t) 0;
|
||||
my_off_t end_of_file= MY_FILEPOS_ERROR;
|
||||
DBUG_ENTER("init_io_cache_ext");
|
||||
DBUG_PRINT("enter",("cache:%p type: %d pos: %llu",
|
||||
info, (int) type, (ulonglong) seek_offset));
|
||||
@ -515,7 +515,7 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type,
|
||||
info->write_end=info->write_buffer+info->buffer_length;
|
||||
info->seek_not_done=1;
|
||||
}
|
||||
info->end_of_file = ~(my_off_t) 0;
|
||||
info->end_of_file= MY_FILE_ERROR;
|
||||
}
|
||||
pos=info->request_pos+(seek_offset-info->pos_in_file);
|
||||
if (type == WRITE_CACHE)
|
||||
@ -586,7 +586,7 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type,
|
||||
info->write_end=(info->buffer + info->buffer_length -
|
||||
(seek_offset & (IO_SIZE-1)));
|
||||
}
|
||||
info->end_of_file= ~(my_off_t) 0;
|
||||
info->end_of_file= MY_FILEPOS_ERROR;
|
||||
}
|
||||
}
|
||||
info->type=type;
|
||||
@ -1792,7 +1792,10 @@ int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock)
|
||||
|
||||
if ((length=(size_t) (info->write_pos - info->write_buffer)))
|
||||
{
|
||||
my_off_t eof= info->end_of_file + info->write_pos - info->append_read_pos;
|
||||
my_off_t eof= info->end_of_file;
|
||||
if (eof != MY_FILE_ERROR)
|
||||
eof+= info->write_pos - info->append_read_pos;
|
||||
|
||||
if (append_cache)
|
||||
{
|
||||
if (tmp_file_track(info, eof) ||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user