Skip to content

Commit

Permalink
Plugins (gforce): Fix new-delete-type-mismatch
Browse files Browse the repository at this point in the history
.. by adding the missing virtual destructor to class Hashable.

ASan output was:
> =================================================================
> ==21660==ERROR: AddressSanitizer: new-delete-type-mismatch on 0x603000079d20 in thread T0:
>   object passed to delete has wrong type:
>   size of the allocated type:   32 bytes;
>   size of the deallocated type: 8 bytes.
>     #0 0x7f98137dc2a7 in operator delete(void*, unsigned long) /var/tmp/portage/sys-devel/gcc-11.3.1_p20221223/work/gcc-11-20221223/libsanitizer/asan/asan_new_delete.cpp:172
>     #1 0x7f9802700116 in Hashtable::RemoveAll() [..]/libvisual-plugins/plugins/actor/G-Force/Common/GeneralTools/Hashtable.cpp:202
>     #2 0x7f980270023f in Hashtable::~Hashtable() [..]/libvisual-plugins/plugins/actor/G-Force/Common/GeneralTools/Hashtable.cpp:32
>     #3 0x7f98026dc9d5 in ExpressionDict::~ExpressionDict() ../../../../plugins/actor/G-Force/Common/math/Headers/ExpressionDict.h:20
>     #4 0x7f98026dc9d5 in WaveShape::~WaveShape() ../../../../plugins/actor/G-Force/GForceCommon/Headers/WaveShape.h:11
>     #5 0x7f98026dc9d5 in GForce::~GForce() [..]/libvisual-plugins/plugins/actor/G-Force/GForceCommon/G-Force.cpp:249
>     #6 0x7f980270e7a5 in lv_gforce_cleanup [..]/libvisual-plugins/plugins/actor/G-Force/unix/libvisual/actor_gforce.cpp:140
>     #7 0x7f981367e236 in visual_plugin_unload [..]/libvisual/libvisual/lv_plugin.c:655
>     #8 0x7f9813674563 in actor_dtor [..]/libvisual/libvisual/lv_actor.c:52
>     #9 0x7f98136aa9e8 in visual_object_destroy [..]/libvisual/libvisual/lv_object.c:104
>     #10 0x7f981367c090 in visual_bin_switch_finalize [..]/libvisual/libvisual/lv_bin.c:695
>     #11 0x7f981367c9dd in visual_bin_run [..]/libvisual/libvisual/lv_bin.c:853
>     #12 0x5649c53eeedc in LV::Bin::run() [..]/libvisual/tools/lv-tool/lv-tool.cpp:108
>     #13 0x5649c53eeedc in main [..]/libvisual/tools/lv-tool/lv-tool.cpp:853
>     #14 0x7f981317e209  (/lib64/libc.so.6+0x2a209)
>     #15 0x7f981317e2bb in __libc_start_main (/lib64/libc.so.6+0x2a2bb)
>     #16 0x5649c53f2110 in _start ([..]/INSTALL_PREFIX/bin/lv-tool+0xa110)
>
> 0x603000079d20 is located 0 bytes inside of 32-byte region [0x603000079d20,0x603000079d40)
> allocated by thread T0 here:
>     #0 0x7f98137db247 in operator new(unsigned long) /var/tmp/portage/sys-devel/gcc-11.3.1_p20221223/work/gcc-11-20221223/libsanitizer/asan/asan_new_delete.cpp:99
>     #1 0x7f98026edd5e in ExpressionDict::AddVar(char*, float*) [..]/libvisual-plugins/plugins/actor/G-Force/Common/math/ExpressionDict.cpp:15
>     #2 0x7f98026e9331 in ExpressionDict::AddVar(UtilStr&, float*) [..]/libvisual-plugins/plugins/actor/G-Force/Common/math/Headers/ExpressionDict.h:27
>     #3 0x7f98026e9331 in ExprArray::Compile(ArgList const&, long, ExpressionDict&) [..]/libvisual-plugins/plugins/actor/G-Force/Common/math/ExprArray.cpp:67
>     #4 0x7f98026e0900 in WaveShape::Load(ArgList&, long) [..]/libvisual-plugins/plugins/actor/G-Force/GForceCommon/WaveShape.cpp:76
>     #5 0x7f98026d898d in GForce::loadWaveShape(long, bool) [..]/libvisual-plugins/plugins/actor/G-Force/GForceCommon/G-Force.cpp:1251
>     #6 0x7f98026db109 in GForce::RecordSample(long) [..]/libvisual-plugins/plugins/actor/G-Force/GForceCommon/G-Force.cpp:917
>     #7 0x7f980270ea8e in lv_gforce_render [..]/libvisual-plugins/plugins/actor/G-Force/unix/libvisual/actor_gforce.cpp:264
>     #8 0x7f98136767de in visual_actor_run [..]/libvisual/libvisual/lv_actor.c:777
>     #9 0x7f981367c71a in visual_bin_run [..]/libvisual/libvisual/lv_bin.c:865
>     #10 0x5649c53eeedc in LV::Bin::run() [..]/libvisual/tools/lv-tool/lv-tool.cpp:108
>     #11 0x5649c53eeedc in main [..]/libvisual/tools/lv-tool/lv-tool.cpp:853
>     #12 0x7f981317e209  (/lib64/libc.so.6+0x2a209)
>
> SUMMARY: AddressSanitizer: new-delete-type-mismatch /var/tmp/portage/sys-devel/gcc-11.3.1_p20221223/work/gcc-11-20221223/libsanitizer/asan/asan_new_delete.cpp:172 in operator delete(void*, unsigned long)
> ==21660==HINT: if you don't care about these errors you may set ASAN_OPTIONS=new_delete_type_mismatch=0
> ==21660==ABORTING
  • Loading branch information
hartwork committed Jan 25, 2023
1 parent e7e2c53 commit b4fda8d
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class Hashable {
virtual long Hash() const = 0;

virtual bool Equals( const Hashable* inComp ) const = 0;

virtual ~Hashable() {};
};

#endif
Expand Down

0 comments on commit b4fda8d

Please sign in to comment.