https://bugs.kde.org/show_bug.cgi?id=456241

            Bug ID: 456241
           Summary: PVS-Studio issues
           Product: frameworks-karchive
           Version: unspecified
          Platform: Compiled Sources
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: fa...@kde.org
          Reporter: nmariu...@gmail.com
                CC: kdelibs-b...@kde.org
  Target Milestone: ---

STEPS TO REPRODUCE
I have Kubuntu 22.04. I have installed Qt5 using kdesrc-build.
Pseudocode:
rm -rf /home/n/kde/build-pvs/frameworks/karchive
mkdir -p /home/n/kde/build-pvs/frameworks/karchive && cd
/home/n/kde/build-pvs/frameworks/karchive

export CMAKE_PREFIX_PATH=/home/n/kde/qt5:/home/n/kde/usr
export
XDG_DATA_DIRS=/home/n/kde/usr/share:/usr/share/plasma:/usr/local/share:/usr/share:/var/lib/snapd/desktop
export
PKG_CONFIG_PATH=/home/n/kde/usr/lib/pkgconfig:/home/n/kde/qt5/lib/pkgconfig
export
PATH=/home/n/kde/usr/bin:/home/n/kde/qt5/bin:/home/n/kde/src/kdesrc-build:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
export
CMAKE_MODULE_PATH=/home/n/kde/qt5/lib/cmake:/home/n/kde/usr/lib64/cmake:/home/n/kde/usr/lib/cmake
export LD_LIBRARY_PATH=/home/n/kde/usr/lib:/home/n/kde/qt5/lib

cmake -B . -S /home/n/kde/src/frameworks/karchive -G Unix\ Makefiles
-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON -DCMAKE_BUILD_TYPE=Debug
-DCMAKE_CXX_FLAGS:STRING=-pipe -DCMAKE_INSTALL_PREFIX=/home/n/kde/usr
-DCMAKE_PREFIX_PATH=/home/n/kde/qt5

pvs-studio-analyzer trace -- make -j 16
pvs-studio-analyzer analyze -j 16 -o PVS-Studio.log
plog-converter -a GA:1,2 -d V1042,V1053,V1044 -t tasklist -o report.tasks
PVS-Studio.log

OBSERVED RESULT

The file report.tasks can be opened with Qt Creator. File > Open File or
Project. It will be shown in the "Issues" Output Pane (Alt+1).

Below is the file report.tasks:

/home/n/kde/src/frameworks/karchive/autotests/karchivetest.h    54      warn   
V524 It is odd that the body of 'testTarReadWrite_data' function is fully
equivalent to the body of 'testReadTar_data' function.
/home/n/kde/src/frameworks/karchive/autotests/karchivetest.h    113     warn   
V524 It is odd that the body of 'test7ZipReadWrite_data' function is fully
equivalent to the body of 'testRead7Zip_data' function.
/home/n/kde/src/frameworks/karchive/src/karchive.cpp    402     warn    V560 A
part of conditional expression is always true: data.constData().
/home/n/kde/src/frameworks/karchive/src/k7zip.cpp       621     err     V610
Undefined behavior. Check the shift operator '<<'. The right operand ('(8 * i)'
= [0..56]) is greater than or equal to the length in bits of the promoted left
operand.
/home/n/kde/src/frameworks/karchive/src/k7zip.cpp       621     err     V629
Consider inspecting the expression. Bit shifting of the 32-bit value with a
subsequent expansion to the 64-bit type.
/home/n/kde/src/frameworks/karchive/src/k7zip.cpp       1515    warn    V547
Expression 'unpackSize != unpackSize64' is always false.
/home/n/kde/src/frameworks/karchive/src/k7zip.cpp       2146    warn    V688
The 'digestsDefined' local variable possesses the same name as one of the class
members, which can result in a confusion.
/home/n/kde/src/frameworks/karchive/src/k7zip.cpp       2147    warn    V688
The 'digests' local variable possesses the same name as one of the class
members, which can result in a confusion.
/home/n/kde/src/frameworks/karchive/src/k7zip.cpp       2198    warn    V688
The 'isAnti' local variable possesses the same name as one of the class
members, which can result in a confusion.
/home/n/kde/src/frameworks/karchive/src/k7zip.cpp       2730    warn    V688
The 'd' local variable possesses the same name as one of the class members,
which can result in a confusion.
/home/n/kde/src/frameworks/karchive/src/k7zip.cpp       2394    warn    V506
Pointer to local variable 'inBuffer' is stored outside the scope of this
variable. Such a pointer will become invalid.
/home/n/kde/src/frameworks/karchive/src/k7zip.cpp       2423    warn    V506
Pointer to local variable 'decodedData' is stored outside the scope of this
variable. Such a pointer will become invalid.
/home/n/kde/src/frameworks/karchive/src/kgzipfilter.cpp 328     warn    V1048
The 'd->zStream.next_in' variable was assigned the same value.
/home/n/kde/src/frameworks/karchive/src/kgzipfilter.cpp 329     warn    V1048
The 'd->zStream.avail_in' variable was assigned the same value.
/home/n/kde/src/frameworks/karchive/src/kzstdfilter.cpp 18      warn    V730
Not all members of a class are initialized inside the compiler generated
constructor. Consider inspecting: inBuffer, outBuffer.
/home/n/kde/src/frameworks/karchive/src/ktar.cpp        533     warn    V688
The 'd' local variable possesses the same name as one of the class members,
which can result in a confusion.
/home/n/kde/src/frameworks/karchive/src/kxzfilter.cpp   173     warn    V506
Pointer to local variable 'lzma_opt' is stored outside the scope of this
variable. Such a pointer will become invalid.
/home/n/kde/src/frameworks/karchive/src/kzip.cpp        1217    err     V595
The 'd->m_currentFile' pointer was utilized before it was verified against
nullptr. Check lines: 1217, 1225.
/home/n/kde/src/frameworks/karchive/src/kzip.cpp        1444    warn    V668
There is no sense in testing the 'filterDev' pointer against null, as the
memory was allocated using the 'new' operator. The exception will be generated
in the case of memory allocation error.

EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Kubuntu 22.04
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to