Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Charles Southerland
frama-c
Commits
2d771f5e
Commit
2d771f5e
authored
4 years ago
by
Loïc Correnson
Browse files
Options
Downloads
Patches
Plain Diff
[server] escaped incorrect field name
parent
4187069a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/server/data.ml
+12
-9
12 additions, 9 deletions
src/plugins/server/data.ml
with
12 additions
and
9 deletions
src/plugins/server/data.ml
+
12
−
9
View file @
2d771f5e
...
...
@@ -332,18 +332,21 @@ struct
if
s
.
published
then
raise
(
Invalid_argument
"Server.Data.Record: already published"
)
let
is_valid_field_name
s
name
=
if
List
.
exists
(
fun
f
->
String
.
equal
f
.
Package
.
fd_name
name
)
s
.
fields
then
raise
(
Invalid_argument
(
"Server.Data.Record: a field with name '"
^
name
^
"' already exists"
))
;
if
not
(
Str
.
string_match
(
Str
.
regexp
"[a-zA-Z0-9 _-]+$"
)
name
0
)
then
raise
(
Invalid_argument
(
"Server.Data.Record: field names must not be \
exotic ('"
^
name
^
"')"
))
let
check_field_name
s
name
=
begin
if
List
.
exists
(
fun
f
->
f
.
Package
.
fd_name
=
name
)
s
.
fields
then
(
let
msg
=
Printf
.
sprintf
"Server.Data.Record: duplicate field %S"
name
in
raise
(
Invalid_argument
msg
));
if
not
(
Str
.
string_match
(
Str
.
regexp
"[a-zA-Z0-9 _-]+$"
)
name
0
)
then
(
let
msg
=
Printf
.
sprintf
"Server.Data.Record: invalid characters for field %S"
name
in
raise
(
Invalid_argument
msg
));
end
let
field
(
type
a
r
)
(
s
:
r
signature
)
~
name
~
descr
?
default
(
d
:
a
data
)
:
(
r
,
a
)
field
=
not_published
s
;
is_valid
_field_name
s
name
;
check
_field_name
s
name
;
let
module
D
=
(
val
d
)
in
begin
match
default
with
|
None
->
()
...
...
@@ -363,7 +366,7 @@ struct
let
option
(
type
a
r
)
(
s
:
r
signature
)
~
name
~
descr
(
d
:
a
data
)
:
(
r
,
a
option
)
field
=
not_published
s
;
is_valid
_field_name
s
name
;
check
_field_name
s
name
;
let
module
D
=
(
val
d
)
in
let
field
=
Package
.{
fd_name
=
name
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment