Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
e4acc853
Commit
e4acc853
authored
Jun 02, 2015
by
Uwe Schulzweida
Browse files
gribapiDefParam: check range of parameter number
parent
b4889299
Changes
3
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
e4acc853
2015-06-02 Uwe Schulzweida
* gribapiDefParam: check range of parameter number
2015-05-28 Uwe Schulzweida
* dmemory: added env. MEMORY_INFO
...
...
src/stream_cgribex.c
View file @
e4acc853
...
...
@@ -1421,7 +1421,7 @@ void cgribexDefParam(int *isec1, int param)
static
bool
lwarn_pnum
=
true
;
if
(
pnum
>
255
&&
lwarn_pnum
)
{
Warning
(
"Parameter number %d out of
bounds
(1-255), set to %d!"
,
pnum
,
pnum
%
256
);
Warning
(
"Parameter number %d out of
range
(1-255), set to %d!"
,
pnum
,
pnum
%
256
);
lwarn_pnum
=
false
;
pnum
=
pnum
%
256
;
}
...
...
src/stream_gribapi.c
View file @
e4acc853
...
...
@@ -1598,6 +1598,14 @@ void gribapiDefParam(int editionNumber, grib_handle *gh, int param, const char *
{
if
(
pnum
<
0
)
pnum
=
-
pnum
;
static
bool
lwarn_pnum
=
true
;
if
(
pnum
>
255
&&
lwarn_pnum
)
{
Warning
(
"Parameter number %d out of range (1-255), set to %d!"
,
pnum
,
pnum
%
256
);
lwarn_pnum
=
false
;
pnum
=
pnum
%
256
;
}
if
(
editionNumber
<=
1
)
{
static
bool
lwarn_pdis
=
true
;
...
...
@@ -1609,14 +1617,6 @@ void gribapiDefParam(int editionNumber, grib_handle *gh, int param, const char *
lwarn_pdis
=
false
;
}
static
bool
lwarn_pnum
=
true
;
if
(
pnum
>
255
&&
lwarn_pnum
)
{
Warning
(
"Parameter number %d out of bounds (1-255), set to %d!"
,
pnum
,
pnum
%
256
);
lwarn_pnum
=
false
;
pnum
=
pnum
%
256
;
}
GRIB_CHECK
(
my_grib_set_long
(
gh
,
"table2Version"
,
pcat
),
0
);
GRIB_CHECK
(
my_grib_set_long
(
gh
,
"indicatorOfParameter"
,
pnum
),
0
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment