Skip to content

Commit

Permalink
[fix](mysql)fix mysql row buffer open_dynamic_mode make _pos pointer …
Browse files Browse the repository at this point in the history
…out range of _buf #37936 (#38149)
  • Loading branch information
amorynan authored Jul 28, 2024
1 parent 1079af3 commit aedec6e
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
3 changes: 2 additions & 1 deletion be/src/util/mysql_row_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ namespace doris {
static uint8_t NEXT_TWO_BYTE = 252;
static uint8_t NEXT_THREE_BYTE = 253;
static uint8_t NEXT_EIGHT_BYTE = 254;
static size_t EXTRA_RESERVE_BYTE = 16;

// the first byte:
// <= 250: length
Expand Down Expand Up @@ -133,7 +134,7 @@ int MysqlRowBuffer<is_binary_format>::reserve(int64_t size) {
return 0;
}

int64_t alloc_size = std::max(need_size, _buf_size * 2);
int64_t alloc_size = std::max(need_size, _buf_size * 2) + EXTRA_RESERVE_BYTE;
char* new_buf = new (std::nothrow) char[alloc_size];

if (nullptr == new_buf) {
Expand Down
Loading

0 comments on commit aedec6e

Please sign in to comment.