From f939d80f4cbf166b5d6d72600cf6a07b60af6347 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Thu, 5 Mar 2015 18:38:36 +0300 Subject: [PATCH] fixed seg faults --- modules/gpu/src/cuda/copy_make_border.cu | 6 +++++- modules/gpu/src/cuda/resize.cu | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/gpu/src/cuda/copy_make_border.cu b/modules/gpu/src/cuda/copy_make_border.cu index 3bd0c8f5e9..3ae29a38a1 100644 --- a/modules/gpu/src/cuda/copy_make_border.cu +++ b/modules/gpu/src/cuda/copy_make_border.cu @@ -97,7 +97,11 @@ namespace cv { namespace gpu { namespace device #endif }; - callers[borderMode](PtrStepSz(src), PtrStepSz(dst), top, left, borderValue, stream); + const caller_t caller = callers[borderMode]; + if (!caller) + cv::gpu::error("Unsupported input parameters for copyMakeBorder", __FILE__, __LINE__, ""); + + caller(PtrStepSz(src), PtrStepSz(dst), top, left, borderValue, stream); } template void copyMakeBorder_gpu(const PtrStepSzb& src, const PtrStepSzb& dst, int top, int left, int borderMode, const uchar* borderValue, cudaStream_t stream); diff --git a/modules/gpu/src/cuda/resize.cu b/modules/gpu/src/cuda/resize.cu index ed3806be85..11a90ab243 100644 --- a/modules/gpu/src/cuda/resize.cu +++ b/modules/gpu/src/cuda/resize.cu @@ -485,7 +485,11 @@ namespace cv { namespace gpu { namespace device if (interpolation == 3 && (fx <= 1.f || fy <= 1.f)) interpolation = 1; - funcs[interpolation](static_cast< PtrStepSz >(src), static_cast< PtrStepSz >(srcWhole), yoff, xoff, static_cast< PtrStepSz >(dst), fy, fx, stream); + const func_t func = funcs[interpolation]; + if (!func) + cv::gpu::error("Unsupported input parameters for resize", __FILE__, __LINE__, ""); + + func(static_cast< PtrStepSz >(src), static_cast< PtrStepSz >(srcWhole), yoff, xoff, static_cast< PtrStepSz >(dst), fy, fx, stream); } template void resize(const PtrStepSzb& src, const PtrStepSzb& srcWhole, int yoff, int xoff, const PtrStepSzb& dst, float fy, float fx, int interpolation, cudaStream_t stream);