The following issues were found
samples/python/tutorial_code/ImgTrans/LaPlace/laplace_demo.py
3 issues
Line: 6
Column: 1
@brief Sample code showing how to detect edges using the Laplace operator
"""
import sys
import cv2 as cv
def main(argv):
# [variables]
# Declare the variables we are going to use
ddepth = cv.CV_16S
Reported by Pylint.
Line: 8
Column: 1
import sys
import cv2 as cv
def main(argv):
# [variables]
# Declare the variables we are going to use
ddepth = cv.CV_16S
kernel_size = 3
window_name = "Laplace Demo"
Reported by Pylint.
Line: 17
Column: 5
# [variables]
# [load]
imageName = argv[0] if len(argv) > 0 else 'lena.jpg'
src = cv.imread(cv.samples.findFile(imageName), cv.IMREAD_COLOR) # Load an image
# Check if image is loaded fine
if src is None:
Reported by Pylint.
3rdparty/protobuf/src/google/protobuf/stubs/stringprintf.cc
3 issues
Line: 64
CWE codes:
664
// the data in it upon use. The fix is to make a copy
// of the structure before using it and use that copy instead.
va_list backup_ap;
va_copy(backup_ap, ap);
int result = vsnprintf(space, kSpaceLength, format, backup_ap);
va_end(backup_ap);
if (result < kSpaceLength) {
if (result >= 0) {
Reported by Cppcheck.
Line: 65
CWE codes:
664
// of the structure before using it and use that copy instead.
va_list backup_ap;
va_copy(backup_ap, ap);
int result = vsnprintf(space, kSpaceLength, format, backup_ap);
va_end(backup_ap);
if (result < kSpaceLength) {
if (result >= 0) {
// Normal case -- everything fit.
Reported by Cppcheck.
Line: 66
CWE codes:
664
va_list backup_ap;
va_copy(backup_ap, ap);
int result = vsnprintf(space, kSpaceLength, format, backup_ap);
va_end(backup_ap);
if (result < kSpaceLength) {
if (result >= 0) {
// Normal case -- everything fit.
dst->append(space, result);
Reported by Cppcheck.
samples/python/tutorial_code/introduction/display_image/display_image.py
3 issues
Line: 2
Column: 1
## [imports]
import cv2 as cv
import sys
## [imports]
## [imread]
img = cv.imread(cv.samples.findFile("starry_night.jpg"))
## [imread]
## [empty]
if img is None:
Reported by Pylint.
Line: 1
Column: 1
## [imports]
import cv2 as cv
import sys
## [imports]
## [imread]
img = cv.imread(cv.samples.findFile("starry_night.jpg"))
## [imread]
## [empty]
if img is None:
Reported by Pylint.
Line: 3
Column: 1
## [imports]
import cv2 as cv
import sys
## [imports]
## [imread]
img = cv.imread(cv.samples.findFile("starry_night.jpg"))
## [imread]
## [empty]
if img is None:
Reported by Pylint.
platforms/winpack_dldt/2021.2/build.config.py
3 issues
Line: 1
Column: 1
os.environ['CI_BUILD_NUMBER'] = '2021.2.0-opencv_winpack_dldt'
cmake_vars['ENABLE_V10_SERIALIZE'] = 'ON'
Reported by Pylint.
Line: 3
Column: 1
os.environ['CI_BUILD_NUMBER'] = '2021.2.0-opencv_winpack_dldt'
cmake_vars['ENABLE_V10_SERIALIZE'] = 'ON'
Reported by Pylint.
Line: 1
Column: 1
os.environ['CI_BUILD_NUMBER'] = '2021.2.0-opencv_winpack_dldt'
cmake_vars['ENABLE_V10_SERIALIZE'] = 'ON'
Reported by Pylint.
samples/java/tutorial_code/introduction/documentation/Documentation.java
2 issues
Line: 6
public static void main (String[] args) {
//! [hello_world]
System.out.println ("Hello World!");
//! [hello_world]
}
}
Reported by PMD.
Line: 1
public class Documentation {
public static void main (String[] args) {
//! [hello_world]
System.out.println ("Hello World!");
//! [hello_world]
}
}
Reported by PMD.
platforms/winpack_dldt/2021.4/build.config.py
2 issues
Line: 1
Column: 1
os.environ['CI_BUILD_NUMBER'] = '2021.4.0-opencv_winpack_dldt'
Reported by Pylint.
Line: 1
Column: 1
os.environ['CI_BUILD_NUMBER'] = '2021.4.0-opencv_winpack_dldt'
Reported by Pylint.
samples/python/tutorial_code/imgProc/hough_line_transform/hough_line_transform.py
2 issues
Line: 1
Column: 1
import cv2 as cv
import numpy as np
img = cv.imread(cv.samples.findFile('sudoku.png'))
gray = cv.cvtColor(img,cv.COLOR_BGR2GRAY)
edges = cv.Canny(gray,50,150,apertureSize = 3)
lines = cv.HoughLines(edges,1,np.pi/180,200)
for line in lines:
Reported by Pylint.
Line: 1
Column: 1
import cv2 as cv
import numpy as np
img = cv.imread(cv.samples.findFile('sudoku.png'))
gray = cv.cvtColor(img,cv.COLOR_BGR2GRAY)
edges = cv.Canny(gray,50,150,apertureSize = 3)
lines = cv.HoughLines(edges,1,np.pi/180,200)
for line in lines:
Reported by Pylint.
modules/highgui/src/roiSelector.cpp
2 issues
Line: 201
CWE codes:
908
Rect cv::selectROI(InputArray img, bool showCrosshair, bool fromCenter)
{
ROISelector selector;
return selector.select("ROI selector", img.getMat(), showCrosshair, fromCenter);
}
Rect cv::selectROI(const String& windowName, InputArray img, bool showCrosshair, bool fromCenter)
{
ROISelector selector;
Reported by Cppcheck.
Line: 207
CWE codes:
908
Rect cv::selectROI(const String& windowName, InputArray img, bool showCrosshair, bool fromCenter)
{
ROISelector selector;
return selector.select(windowName, img.getMat(), showCrosshair, fromCenter);
}
void cv::selectROIs(const String& windowName, InputArray img,
std::vector<Rect>& boundingBox, bool showCrosshair, bool fromCenter)
{
Reported by Cppcheck.
modules/dnn/src/torch/THDiskFile.cpp
2 issues
Line: 383
CWE codes:
401
if(total-pos == 0) /* we need more space! */
{
total += TBRS_BSZ;
p = (char*)THRealloc(p, total);
}
if (p == NULL)
THError("read error: failed to allocate buffer");
pos += fread(p+pos, 1, total-pos, dfself->handle);
if (pos < total) /* eof? */
Reported by Cppcheck.
Line: 417
CWE codes:
401
if(total-pos <= 1) /* we can only write '\0' in there! */
{
total += TBRS_BSZ;
p = (char*)THRealloc(p, total);
}
if (p == NULL)
THError("read error: failed to allocate buffer");
if (fgets(p+pos, total-pos, dfself->handle) == NULL) /* eof? */
{
Reported by Cppcheck.
modules/highgui/test/test_gui.cpp
2 issues
Line: 62
&& !defined HAVE_WIN32UI \
&& !defined HAVE_COCOA \
)
TEST(Highgui_GUI, DISABLED_regression)
#else
TEST(Highgui_GUI, regression)
#endif
{
const std::string window_name("opencv_highgui_test_window");
Reported by Cppcheck.
Line: 64
)
TEST(Highgui_GUI, DISABLED_regression)
#else
TEST(Highgui_GUI, regression)
#endif
{
const std::string window_name("opencv_highgui_test_window");
const cv::Size image_size(800, 600);
Reported by Cppcheck.