核心转储,<地址0x5bf6越界>

core dump, <Address 0x5bf6 out of bounds>

本文关键字:0x5bf6 越界 gt 地址 lt 转储 核心      更新时间:2023-10-16

在非常罕见的情况下获取核心转储。这个代码从过去10年一直在使用,直到现在还没有面对这个核心,也没有添加新的代码。怀疑这是因为地址越界,并且不确定是否解析此核心。询问某人对此的建议。提前谢谢。

gdb) fr 8
#8  0x082905e0 in parse(_HTStream*, char const*, int) (me=0x83684f8, data=0x8368710 "", data_len=2896) at WMHttpStream.cpp:1497
1497    WMHttpStream.cpp: No such file or directory.
        in WMHttpStream.cpp
Current language:  auto; currently c++
(gdb) info locals
state = (parser_state *) 0x8368500
guid = {guid = "0&²u216fÏ21¦ÙªbÎl", size = 2013}
data_cur = 0x83689bc "202"
remaining = 2212
block_len = -135896812
type = -1
read_len = 684
parse_done = 1
block_buf = (data_buf_t *) 0x1
__PRETTY_FUNCTION__ = "void parse(HTStream*, const char*, int)"
(gdb) fr 7
#7  0x0828d1c0 in process_file_data(_HTStream*, int, _buf_t*) (me=0x83684f8, type=0, block=0x833d4e0) at WMHttpStream.cpp:1062
1062    in WMHttpStream.cpp
(gdb) info locals
iov = {{iov_base = 0x8357de0, iov_len = 1250}, {iov_base = 0xffe87344, iov_len = 4293424288}, {iov_base = 0xffffffff, iov_len = 0}, {
    iov_base = 0xffffffff, iov_len = 4151443444}, {iov_base = 0xffe874a0, iov_len = 4293423940}, {iov_base = 0xffe873f0, iov_len = 4150651851}, {
    iov_base = 0xffe87344, iov_len = 4159359433}, {iov_base = 0xffe87420, iov_len = 4293424288}, {iov_base = 0x0, iov_len = 4222451713}, {
    iov_base = 0xffe874a0, iov_len = 4293424288}, {iov_base = 0xffe874a0, iov_len = 4293424288}, {iov_base = 0xffe874a3, iov_len = 4294967295}, {
    iov_base = 0xffe874a0, iov_len = 4294967295}, {iov_base = 0x0, iov_len = 0}, {iov_base = 0x0, iov_len = 4150704481}, {iov_base = 0x0,
    iov_len = 4150704481}, {iov_base = 0x0, iov_len = 742}, {iov_base = 0x0, iov_len = 4150704481}, {iov_base = 0xf44942f0,
    iov_len = 4150704481}, {iov_base = 0x2, iov_len = 4150704481}, {iov_base = 0x0, iov_len = 746}, {iov_base = 0x3fd18, iov_len = 4150704481}, {
    iov_base = 0xf7eae414, iov_len = 4150704481}, {iov_base = 0xffe873d8, iov_len = 4150704481}, {iov_base = 0x835efe0, iov_len = 4293424288}, {
    iov_base = 0x2, iov_len = 22284}, {iov_base = 0x836850c, iov_len = 137132324}, {iov_base = 0xffe87418, iov_len = 136869189}, {
    iov_base = 0x8358016, iov_len = 137791248}, {iov_base = 0x2ac, iov_len = 136921305}, {iov_base = 0x82c7924, iov_len = 324}, {
    iov_base = 0x2630, iov_len = 136868550}}
n = 1
stime = 0
ptime = 3303
ds_type = 0
rc = 0
client = (WMHttpClient *) 0x8332688
state = (parser_state *) 0x8368500
stream = (stream_info *) 0x83326b8
asf_head = 0x1 <Address 0x1 out of bounds>
len = 137790720
(gdb)

以下是示例代码片段:

void
process_file_data(HTStream *me, int type, data_buf_t *block)
{
    WMHttpClient *client = me->client;
    parser_state *state = &me->state;
    stream_info *stream = &client->_stream_info;
    char *asf_head;
    int len = 0;
    switch (type) {
    case BLOCK_HEAD:
    {
        len = state->block_len;
        asf_head = (char *)malloc(len);
        if (asf_head == NULL) {
            ad_debug_error("malloc(%d)", len);
            client->EventLoopStop(STOP_FOR_ERROR);
            break;
        }
        copy_from_buf(asf_head, block, len);

是否为块分配了足够的缓冲区大小?如果没有,请检查所有这样的指针,在访问之前是否指向已分配的空间