Fixed a possible out-of-bounds access in error checking when NUM_*_PARAMS is 0
This commit is contained in:
@@ -101,6 +101,10 @@ acDeviceLoadScalarUniform(const Device device, const Stream stream, const AcReal
|
|||||||
const AcReal value)
|
const AcReal value)
|
||||||
{
|
{
|
||||||
cudaSetDevice(device->id);
|
cudaSetDevice(device->id);
|
||||||
|
if (param < 0 || param >= NUM_REAL_PARAMS) {
|
||||||
|
fprintf(stderr, "WARNING: invalid AcRealParam %d\n", param);
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_valid(value)) {
|
if (!is_valid(value)) {
|
||||||
fprintf(stderr, "WARNING: Passed an invalid value %g to device constant %s. Skipping.\n",
|
fprintf(stderr, "WARNING: Passed an invalid value %g to device constant %s. Skipping.\n",
|
||||||
(double)value, realparam_names[param]);
|
(double)value, realparam_names[param]);
|
||||||
@@ -121,6 +125,10 @@ acDeviceLoadVectorUniform(const Device device, const Stream stream, const AcReal
|
|||||||
const AcReal3 value)
|
const AcReal3 value)
|
||||||
{
|
{
|
||||||
cudaSetDevice(device->id);
|
cudaSetDevice(device->id);
|
||||||
|
if (param < 0 || param >= NUM_REAL3_PARAMS) {
|
||||||
|
fprintf(stderr, "WARNING: invalid AcReal3Param %d\n", param);
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_valid(value)) {
|
if (!is_valid(value)) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"WARNING: Passed an invalid value (%g, %g, %g) to device constant %s. Skipping.\n",
|
"WARNING: Passed an invalid value (%g, %g, %g) to device constant %s. Skipping.\n",
|
||||||
@@ -142,6 +150,10 @@ acDeviceLoadIntUniform(const Device device, const Stream stream, const AcIntPara
|
|||||||
const int value)
|
const int value)
|
||||||
{
|
{
|
||||||
cudaSetDevice(device->id);
|
cudaSetDevice(device->id);
|
||||||
|
if (param < 0 || param >= NUM_INT_PARAMS) {
|
||||||
|
fprintf(stderr, "WARNING: invalid AcIntParam %d\n", param);
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_valid(value)) {
|
if (!is_valid(value)) {
|
||||||
fprintf(stderr, "WARNING: Passed an invalid value %d to device constant %s. Skipping.\n",
|
fprintf(stderr, "WARNING: Passed an invalid value %d to device constant %s. Skipping.\n",
|
||||||
value, intparam_names[param]);
|
value, intparam_names[param]);
|
||||||
@@ -162,6 +174,10 @@ acDeviceLoadInt3Uniform(const Device device, const Stream stream, const AcInt3Pa
|
|||||||
const int3 value)
|
const int3 value)
|
||||||
{
|
{
|
||||||
cudaSetDevice(device->id);
|
cudaSetDevice(device->id);
|
||||||
|
if (param < 0 || param >= NUM_INT3_PARAMS) {
|
||||||
|
fprintf(stderr, "WARNING: invalid AcInt3Param %d\n", param);
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_valid(value.x) || !is_valid(value.y) || !is_valid(value.z)) {
|
if (!is_valid(value.x) || !is_valid(value.y) || !is_valid(value.z)) {
|
||||||
fprintf(
|
fprintf(
|
||||||
stderr,
|
stderr,
|
||||||
|
Reference in New Issue
Block a user