Summary
convolve_2d() in xrspatial/convolution.py doesn't validate its input before handing it to the backend kernel. Pass a boolean, string, or complex-dtype DataArray and you get a numba TypingError or a cupy crash instead of a ValueError that says what went wrong.
Cat 6 (input validation) finding deferred from PR #1243 (issue #1241).
Reproducer
import numpy as np
import xarray as xr
from xrspatial.convolution import convolve_2d, circle_kernel
agg = xr.DataArray(np.ones((10, 10), dtype=bool))
kernel = circle_kernel(1, 1, 2)
convolve_2d(agg.data, kernel) # numba TypingError, not ValueError
Expected
A ValueError from _validate_raster naming the function and the bad dtype. PR #1384 already taught _validate_raster to reject complex dtypes, so one call covers boolean, string, and complex.
Fix
Call _validate_raster(xr.DataArray(data), func_name='convolve_2d', ndim=2) at the top of convolve_2d(), before the kernel runs.
Severity
MEDIUM. No exploit path; just confusing errors at the API boundary.
Summary
convolve_2d()inxrspatial/convolution.pydoesn't validate its input before handing it to the backend kernel. Pass a boolean, string, or complex-dtype DataArray and you get a numba TypingError or a cupy crash instead of a ValueError that says what went wrong.Cat 6 (input validation) finding deferred from PR #1243 (issue #1241).
Reproducer
Expected
A
ValueErrorfrom_validate_rasternaming the function and the bad dtype. PR #1384 already taught_validate_rasterto reject complex dtypes, so one call covers boolean, string, and complex.Fix
Call
_validate_raster(xr.DataArray(data), func_name='convolve_2d', ndim=2)at the top ofconvolve_2d(), before the kernel runs.Severity
MEDIUM. No exploit path; just confusing errors at the API boundary.