Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 12060: calculate sizeof(struct) #5919

Merged
merged 2 commits into from
Jan 29, 2024

Conversation

pfultz2
Copy link
Contributor

@pfultz2 pfultz2 commented Jan 29, 2024

No description provided.

@orbitcowboy orbitcowboy merged commit 90d7f72 into danmar:main Jan 29, 2024
64 checks passed
@SChernykh
Copy link
Contributor

@pfultz2 I started getting Segmentation fault (core dumped) on my project after this commit. Maybe you don't check for nullptr somewhere here? It's either scope or vt or both that should be checked for nullptr

@pfultz2 pfultz2 deleted the valueflow-sizeof-struct branch January 29, 2024 13:21
@SChernykh
Copy link
Contributor

Pasting the crash callstack here too for visibility:

Program received signal SIGSEGV, Segmentation fault.
0x0000555555e777df in std::__debug::list<Variable, std::allocator<Variable> >::begin (this=<error reading variable: Cannot access memory at address 0x7fffff7feff0>)
    at /usr/include/c++/11/debug/list:231
231           begin() const _GLIBCXX_NOEXCEPT
(gdb) bt
#0  0x0000555555e777df in std::__debug::list<Variable, std::allocator<Variable> >::begin (this=<error reading variable: Cannot access memory at address 0x7fffff7feff0>)
    at /usr/include/c++/11/debug/list:231
#1  0x0000555555e1e814 in accumulateStructMembers<getAlignOf(const ValueType&, const Settings&)::<lambda(size_t, const ValueType&)> >(const Scope *, struct {...}) (scope=0x55555d188780,
    f=...) at lib/valueflow.cpp:1112
#2  0x0000555555dec4a1 in getAlignOf (vt=..., settings=...) at lib/valueflow.cpp:1147
#3  0x0000555555dec3cf in operator() (__closure=0x7fffff7ff140, max=0, vt2=...) at lib/valueflow.cpp:1148
#4  0x0000555555e1e8ad in accumulateStructMembers<getAlignOf(const ValueType&, const Settings&)::<lambda(size_t, const ValueType&)> >(const Scope *, struct {...}) (scope=0x55555d1eccd0,
    f=...) at lib/valueflow.cpp:1118
#5  0x0000555555dec4a1 in getAlignOf (vt=..., settings=...) at lib/valueflow.cpp:1147
#6  0x0000555555dec3cf in operator() (__closure=0x7fffff7ff260, max=0, vt2=...) at lib/valueflow.cpp:1148
#7  0x0000555555e1e8ad in accumulateStructMembers<getAlignOf(const ValueType&, const Settings&)::<lambda(size_t, const ValueType&)> >(const Scope *, struct {...}) (scope=0x55555d214ac0,
    f=...) at lib/valueflow.cpp:1118
#8  0x0000555555dec4a1 in getAlignOf (vt=..., settings=...) at lib/valueflow.cpp:1147
#9  0x0000555555dec3cf in operator() (__closure=0x7fffff7ff380, max=4, vt2=...) at lib/valueflow.cpp:1148
#10 0x0000555555e1e8ad in accumulateStructMembers<getAlignOf(const ValueType&, const Settings&)::<lambda(size_t, const ValueType&)> >(const Scope *, struct {...}) (scope=0x55555d188060,
    f=...) at lib/valueflow.cpp:1118
#11 0x0000555555dec4a1 in getAlignOf (vt=..., settings=...) at lib/valueflow.cpp:1147
#12 0x0000555555dec3cf in operator() (__closure=0x7fffff7ff4a0, max=8, vt2=...) at lib/valueflow.cpp:1148
#13 0x0000555555e1e8ad in accumulateStructMembers<getAlignOf(const ValueType&, const Settings&)::<lambda(size_t, const ValueType&)> >(const Scope *, struct {...}) (scope=0x55555d188780,
    f=...) at lib/valueflow.cpp:1118
#14 0x0000555555dec4a1 in getAlignOf (vt=..., settings=...) at lib/valueflow.cpp:1147
#15 0x0000555555dec3cf in operator() (__closure=0x7fffff7ff5c0, max=0, vt2=...) at lib/valueflow.cpp:1148
#16 0x0000555555e1e8ad in accumulateStructMembers<getAlignOf(const ValueType&, const Settings&)::<lambda(size_t, const ValueType&)> >(const Scope *, struct {...}) (scope=0x55555d1eccd0,
    f=...) at lib/valueflow.cpp:1118
#17 0x0000555555dec4a1 in getAlignOf (vt=..., settings=...) at lib/valueflow.cpp:1147
#18 0x0000555555dec3cf in operator() (__closure=0x7fffff7ff6e0, max=0, vt2=...) at lib/valueflow.cpp:1148
#19 0x0000555555e1e8ad in accumulateStructMembers<getAlignOf(const ValueType&, const Settings&)::<lambda(size_t, const ValueType&)> >(const Scope *, struct {...}) (scope=0x55555d214ac0,
    f=...) at lib/valueflow.cpp:1118
#20 0x0000555555dec4a1 in getAlignOf (vt=..., settings=...) at lib/valueflow.cpp:1147
#21 0x0000555555dec3cf in operator() (__closure=0x7fffff7ff800, max=4, vt2=...) at lib/valueflow.cpp:1148
#22 0x0000555555e1e8ad in accumulateStructMembers<getAlignOf(const ValueType&, const Settings&)::<lambda(size_t, const ValueType&)> >(const Scope *, struct {...}) (scope=0x55555d188060,
    f=...) at lib/valueflow.cpp:1118
#23 0x0000555555dec4a1 in getAlignOf (vt=..., settings=...) at lib/valueflow.cpp:1147
#24 0x0000555555dec3cf in operator() (__closure=0x7fffff7ff920, max=8, vt2=...) at lib/valueflow.cpp:1148
#25 0x0000555555e1e8ad in accumulateStructMembers<getAlignOf(const ValueType&, const Settings&)::<lambda(size_t, const ValueType&)> >(const Scope *, struct {...}) (scope=0x55555d188780,
    f=...) at lib/valueflow.cpp:1118
#26 0x0000555555dec4a1 in getAlignOf (vt=..., settings=...) at lib/valueflow.cpp:1147
#27 0x0000555555dec3cf in operator() (__closure=0x7fffff7ffa40, max=0, vt2=...) at lib/valueflow.cpp:1148
#28 0x0000555555e1e8ad in accumulateStructMembers<getAlignOf(const ValueType&, const Settings&)::<lambda(size_t, const ValueType&)> >(const Scope *, struct {...}) (scope=0x55555d1eccd0,
    f=...) at lib/valueflow.cpp:1118
#29 0x0000555555dec4a1 in getAlignOf (vt=..., settings=...) at lib/valueflow.cpp:1147
#30 0x0000555555dec3cf in operator() (__closure=0x7fffff7ffb60, max=0, vt2=...) at lib/valueflow.cpp:1148
#31 0x0000555555e1e8ad in accumulateStructMembers<getAlignOf(const ValueType&, const Settings&)::<lambda(size_t, const ValueType&)> >(const Scope *, struct {...}) (scope=0x55555d214ac0,
    f=...) at lib/valueflow.cpp:1118
#32 0x0000555555dec4a1 in getAlignOf (vt=..., settings=...) at lib/valueflow.cpp:1147

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants