Merge lp:~aacid/qtmir/fix-heap-use-after-free into lp:qtmir
Status: | Rejected |
---|---|
Rejected by: | Michał Sawicz |
Proposed branch: | lp:~aacid/qtmir/fix-heap-use-after-free |
Merge into: | lp:qtmir |
Diff against target: |
13 lines (+2/-1) 1 file modified
src/modules/Unity/Application/desktopfilereader.cpp (+2/-1) |
To merge this branch: | bzr merge lp:~aacid/qtmir/fix-heap-use-after-free |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michał Sawicz | Disapprove | ||
Unity8 CI Bot (community) | continuous-integration | Needs Fixing | |
Lukáš Tinkl (community) | Approve | ||
Review via email: mp+292644@code.launchpad.net |
Commit message
Fix heap-use-after-free reported by ASAN
You can not keep the constData() of a temporary bytearray
ASAN goes with
==30749==ERROR: AddressSanitizer: heap-use-after-free on address 0x6060000039f8 at pc 0x7f1367f582fd bp 0x7ffcc9238c40 sp 0x7ffcc92383e8
READ of size 26 at 0x6060000039f8 thread T0
#0 0x7f1367f582fc (/usr/lib/
#1 0x7f13663bf6d8 in g_str_equal (/lib/x86_
#2 0x7f13663bebae in g_hash_table_lookup (/lib/x86_
#3 0x7f13663cb04d in g_key_file_has_key (/lib/x86_
#4 0x7f1367c69be8 in qtmir::
#5 0x421208 in DesktopFileRead
#6 0x47021e in void testing:
#7 0x47021e in void testing:
#8 0x45e9cd in testing:
#9 0x45eca7 in testing:
#10 0x45ee9c in testing:
#11 0x45f553 in testing:
#12 0x470e1e in bool testing:
#13 0x470e1e in bool testing:
#14 0x45fe14 in testing:
#15 0x41808a in RUN_ALL_TESTS() /usr/include/
#16 0x41808a in main /usr/src/
#17 0x7f1366bc482f in __libc_start_main (/lib/x86_
#18 0x418128 in _start (/home/
0x6060000039f8 is located 24 bytes inside of 64-byte region [0x6060000039e0
freed by thread T0 here:
#0 0x7f1367fa924a in __interceptor_free (/usr/lib/
#1 0x7f1367c69b96 in QTypedArrayData
#2 0x7f1367c69b96 in QByteArray:
#3 0x7f1367c69b96 in qtmir::
#4 0x421208 in DesktopFileRead
#5 0x47021e in void testing:
#6 0x47021e in void testing:
#7 0x45e9cd in testing:
#8 0x45eca7 in testing:
#9 0x45ee9c in testing:
#10 0x45f553 in testing:
#11 0x470e1e in bool testing:
#12 0x470e1e in bool testing:
#13 0x45fe14 in testing:
#14 0x41808a in RUN_ALL_TESTS() /usr/include/
#15 0x41808a in main /usr/src/
#16 0x7f1366bc482f in __libc_start_main (/lib/x86_
previously allocated by thread T0 here:
#0 0x7f1367fa98ca in realloc (/usr/lib/
#1 0x7f13677cb794 in QByteArray:
#2 0xc533d48a9edeb0ff (<unknown module>)
Description of the change
Fix heap-use-after-free when reading localized X-Ubuntu-
Unmerged revisions
- 471. By Albert Astals Cid
-
Fix heap-use-after-free reported by ASAN
You can not keep the constData() of a temporary bytearray
ASAN goes with
==30749==ERROR: AddressSanitizer: heap-use-after-free on address 0x6060000039f8 at pc 0x7f1367f582fd bp 0x7ffcc9238c40 sp 0x7ffcc92383e8
READ of size 26 at 0x6060000039f8 thread T0
#0 0x7f1367f582fc (/usr/lib/x86_64- linux-gnu/ libasan. so.2+0x472fc)
#1 0x7f13663bf6d8 in g_str_equal (/lib/x86_64-linux- gnu/libglib- 2.0.so. 0+0x396d8)
#2 0x7f13663bebae in g_hash_table_lookup (/lib/x86_64-linux- gnu/libglib- 2.0.so. 0+0x38bae)
#3 0x7f13663cb04d in g_key_file_has_key (/lib/x86_64-linux- gnu/libglib- 2.0.so. 0+0x4504d)
#4 0x7f1367c69be8 in qtmir::DesktopFileRead er::splashTitle () const /home/tsdgeos_ work/phablet/ qtmir/set- display- config/ src/modules/ Unity/Applicati on/desktopfiler eader.cpp: 169
#5 0x421208 in DesktopFileReader_testReadsLoc alizedDesktopFi le_Test: :TestBody( ) /home/tsdgeos_ work/phablet/ qtmir/set- display- config/ tests/modules/ DesktopFileRead er/desktopfiler eader_test. cpp:86
#6 0x47021e in void testing::internal: :HandleSehExcep tionsInMethodIf Supported< testing: :Test, void>(testing: :Test*, void (testing: :Test:: *)(), char const*) /usr/src/ gtest/src/ gtest.cc: 2078
#7 0x47021e in void testing::internal: :HandleExceptio nsInMethodIfSup ported< testing: :Test, void>(testing: :Test*, void (testing: :Test:: *)(), char const*) /usr/src/ gtest/src/ gtest.cc: 2114
#8 0x45e9cd in testing::Test:: Run() /usr/src/ gtest/src/ gtest.cc: 2151
#9 0x45eca7 in testing::TestInfo: :Run() /usr/src/ gtest/src/ gtest.cc: 2326
#10 0x45ee9c in testing::TestCase: :Run() /usr/src/ gtest/src/ gtest.cc: 2444
#11 0x45f553 in testing::internal: :UnitTestImpl: :RunAllTests( ) /usr/src/ gtest/src/ gtest.cc: 4315
#12 0x470e1e in bool testing::internal: :HandleSehExcep tionsInMethodIf Supported< testing: :internal: :UnitTestImpl, bool>(testing: :internal: :UnitTestImpl* , bool (testing: :internal: :UnitTestImpl: :*)(), char const*) /usr/src/ gtest/src/ gtest.cc: 2078
#13 0x470e1e in bool testing::internal: :HandleExceptio nsInMethodIfSup ported< testing: :internal: :UnitTestImpl, bool>(testing: :internal: :UnitTestImpl* , bool (testing: :internal: :UnitTestImpl: :*)(), char const*) /usr/src/ gtest/src/ gtest.cc: 2114
#14 0x45fe14 in testing::UnitTest: :Run() /usr/src/ gtest/src/ gtest.cc: 3926
#15 0x41808a in RUN_ALL_TESTS() /usr/include/gtest/gtest. h:2288
#16 0x41808a in main /usr/src/gtest/src/ gtest_main. cc:37
#17 0x7f1366bc482f in __libc_start_main (/lib/x86_64-linux- gnu/libc. so.6+0x2082f)
#18 0x418128 in _start (/home/tsdgeos_ work/phablet/ qtmir/set- display- config/ build/tests/ modules/ DesktopFileRead er/desktop_ file_reader_ test+0x418128) 0x6060000039f8 is located 24 bytes inside of 64-byte region [0x6060000039e0
,0x606000003a20 )
freed by thread T0 here:
#0 0x7f1367fa924a in __interceptor_free (/usr/lib/x86_64- linux-gnu/ libasan. so.2+0x9824a)
#1 0x7f1367c69b96 in QTypedArrayData<char>: :deallocate( QArrayData* ) /usr/include/ x86_64- linux-gnu/ qt5/QtCore/ qarraydata. h:222
#2 0x7f1367c69b96 in QByteArray::~QByteArray( ) /usr/include/ x86_64- linux-gnu/ qt5/QtCore/ qbytearray. h:459
#3 0x7f1367c69b96 in qtmir::DesktopFileRead er::splashTitle () const /home/tsdgeos_ work/phablet/ qtmir/set- display- config/ src/modules/ Unity/Applicati on/desktopfiler eader.cpp: 168
#4 0x421208 in DesktopFileReader_testReadsLoc alizedDesktopFi le_Test: :TestBody( ) /home/tsdgeos_ work/phablet/ qtmir/set- display- config/ tests/modules/ DesktopFileRead er/desktopfiler eader_test. cpp:86
#5 0x47021e in void testing::internal: :HandleSehExcep tionsInMethodIf Supported< testing: :Test, void>(testing: :Test*, void (testing: :Test:: *)(), char const*) /usr/src/ gtest/src/ gtest.cc: 2078
#6 0x47021e in void testing::internal: :HandleExceptio nsInMethodIfSup ported< testing: :Test, void>(testing: :Test*, void (testing: :Test:: *)(), char const*) /usr/src/ gtest/src/ gtest.cc: 2114
#7 0x45e9cd in testing::Test:: Run() /usr/src/ gtest/src/ gtest.cc: 2151
#8 0x45eca7 in testing::TestInfo: :Run() /usr/src/ gtest/src/ gtest.cc: 2326
#9 0x45ee9c in testing::TestCase: :Run() /usr/src/ gtest/src/ gtest.cc: 2444
#10 0x45f553 in testing::internal: :UnitTestImpl: :RunAllTests( ) /usr/src/ gtest/src/ gtest.cc: 4315
#11 0x470e1e in bool testing::internal: :HandleSehExcep tionsInMethodIf Supported< testing: :internal: :UnitTestImpl, bool>(testing: :internal: :UnitTestImpl* , bool (testing: :internal: :UnitTestImpl: :*)(), char const*) /usr/src/ gtest/src/ gtest.cc: 2078
#12 0x470e1e in bool testing::internal: :HandleExceptio nsInMethodIfSup ported< testing: :internal: :UnitTestImpl, bool>(testing: :internal: :UnitTestImpl* , bool (testing: :internal: :UnitTestImpl: :*)(), char const*) /usr/src/ gtest/src/ gtest.cc: 2114
#13 0x45fe14 in testing::UnitTest: :Run() /usr/src/ gtest/src/ gtest.cc: 3926
#14 0x41808a in RUN_ALL_TESTS() /usr/include/gtest/gtest. h:2288
#15 0x41808a in main /usr/src/gtest/src/ gtest_main. cc:37
#16 0x7f1366bc482f in __libc_start_main (/lib/x86_64-linux- gnu/libc. so.6+0x2082f) previously allocated by thread T0 here:
#0 0x7f1367fa98ca in realloc (/usr/lib/x86_64- linux-gnu/ libasan. so.2+0x988ca)
#1 0x7f13677cb794 in QByteArray::reallocData( unsigned int, QFlags< QArrayData: :AllocationOpti on>) (/usr/lib/ x86_64- linux-gnu/ libQt5Core. so.5+0xa9794)
#2 0xc533d48a9edeb0ff (<unknown module>)
LGTM, looks valid to me