Review Request 128277: Fix unsafe KDirModelDirNode* casts
David Faure
faure at kde.org
Mon Jun 27 08:29:34 UTC 2016
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/128277/#review96881
-----------------------------------------------------------
Ship it!
Ship It!
- David Faure
On June 23, 2016, 4:55 p.m., Rob Wu wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/128277/
> -----------------------------------------------------------
>
> (Updated June 23, 2016, 4:55 p.m.)
>
>
> Review request for KDE Frameworks.
>
>
> Repository: kio
>
>
> Description
> -------
>
> Replace two isDir debug assertions with conditionals, because
> there is no guarantee that the parameter is a directory.
>
>
> Diffs
> -----
>
> autotests/kdirmodeltest.cpp 1a14a01
> src/widgets/kdirmodel.cpp eab0121
>
> Diff: https://git.reviewboard.kde.org/r/128277/diff/
>
>
> Testing
> -------
>
> To test, I first configured ASAN by passing the following to cmake:
> `-DCMAKE_CXX_FLAGS="-fsanitize=address -fsanitize=undefined"`
>
> KDirModel::index was tested as follows:
>
> ```
> make kdirmodeltest
> ASAN_OPTIONS=detect_leaks=0 ./autotests/kdirmodeltest testIndex
> ```
>
> KDirModel::fetchMore is tested as follows (manually):
>
> 1. Create `a.out` as follows:
>
> ```c++
> // g++ `pkg-config --cflags --libs Qt5Widgets` main.cpp -fPIC -fsanitize=address
> #include <QApplication>
> #include <QFileDialog>
> #include <QTemporaryDir>
>
> int main(int argc, char **argv) {
> QTemporaryDir tempDir;
> QFile(tempDir.path() + "/filename.tex").open(QIODevice::WriteOnly);
>
> QApplication app(argc, argv);
> QStringList filesNames = QFileDialog::getOpenFileNames(
> Q_NULLPTR, "Open File", tempDir.path(), "TeX files (*.tex)");
>
> return app.exec();
> }
> ```
> 2. Run it. In the file dialog, type "./".
> 3. A dropdown shows the files in the directory ("filename.tex").
> 4. Press arrow down. Now the filename will be matched and NOTHING should happen.
>
> Before this patch, step 4 would crash; This is a reduced test case based on
> a crash when I tried to save my work in TexMaker's (Save As dialog).
>
>
> Thanks,
>
> Rob Wu
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20160627/1f118ff9/attachment-0001.html>
More information about the Kde-frameworks-devel
mailing list