Skip to content

指定对齐未关闭,会导致对象内存布局解析紊乱,程序崩溃 #2

@HuangdaxianZaixian

Description

@HuangdaxianZaixian

在pstream.h中,指定字节对齐后,未恢复自然对齐
#pragma pack (1)
typedef union littel_endian_size_s {
unsigned short int length;
unsigned char byte[2];
} littel_endian_size;
......

具体会导致的问题,可以参考该网址下的具体bug分析:
https://www.zhihu.com/question/323920295/answer/681105149
<问题已解决> c++ 类对象的数据成员地址在局部函数调用中发生诡异偏移,字节对齐发生变化?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions