Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Havar
asn1c
Commits
f7982283
Commit
f7982283
authored
Mar 16, 2013
by
Lev Walkin
Browse files
fix: There must be no content in self-terminating <NULL/> tag.
parent
cad560ae
Changes
5
Hide whitespace changes
Inline
Side-by-side
skeletons/BOOLEAN.c
View file @
f7982283
...
...
@@ -161,10 +161,7 @@ BOOLEAN__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chun
}
return
XPBD_BODY_CONSUMED
;
}
else
{
if
(
xer_is_whitespace
(
chunk_buf
,
chunk_size
))
return
XPBD_NOT_BODY_IGNORE
;
else
return
XPBD_BROKEN_ENCODING
;
return
XPBD_BROKEN_ENCODING
;
}
}
...
...
skeletons/NULL.c
View file @
f7982283
...
...
@@ -74,10 +74,13 @@ NULL__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_b
(
void
)
td
;
(
void
)
sptr
;
if
(
xer_is_whitespace
(
chunk_buf
,
chunk_size
))
return
XPBD_BODY_CONSUMED
;
else
/*
* There must be no content in self-terminating <NULL/> tag.
*/
if
(
chunk_size
)
return
XPBD_BROKEN_ENCODING
;
else
return
XPBD_BODY_CONSUMED
;
}
asn_dec_rval_t
...
...
skeletons/asn_codecs_prim.c
View file @
f7982283
...
...
@@ -186,9 +186,10 @@ static ssize_t
xer_decode__primitive_body
(
void
*
key
,
const
void
*
chunk_buf
,
size_t
chunk_size
,
int
have_more
)
{
struct
xdp_arg_s
*
arg
=
(
struct
xdp_arg_s
*
)
key
;
enum
xer_pbd_rval
bret
;
size_t
lead_wsp_size
;
if
(
arg
->
decoded_something
)
{
if
(
xer_
is_
whitespace
(
chunk_buf
,
chunk_size
))
{
if
(
xer_whitespace
_span
(
chunk_buf
,
chunk_size
)
==
chunk_size
)
{
/*
* Example:
* "<INTEGER>123<!--/--> </INTEGER>"
...
...
@@ -215,6 +216,10 @@ xer_decode__primitive_body(void *key, const void *chunk_buf, size_t chunk_size,
return
-
1
;
}
lead_wsp_size
=
xer_whitespace_span
(
chunk_buf
,
chunk_size
);
chunk_buf
+=
lead_wsp_size
;
chunk_size
-=
lead_wsp_size
;
bret
=
arg
->
prim_body_decoder
(
arg
->
type_descriptor
,
arg
->
struct_key
,
chunk_buf
,
chunk_size
);
switch
(
bret
)
{
...
...
@@ -227,7 +232,7 @@ xer_decode__primitive_body(void *key, const void *chunk_buf, size_t chunk_size,
arg
->
decoded_something
=
1
;
/* Fall through */
case
XPBD_NOT_BODY_IGNORE
:
/* Safe to proceed further */
return
chunk_size
;
return
lead_wsp_size
+
chunk_size
;
}
return
-
1
;
...
...
skeletons/xer_decoder.c
View file @
f7982283
...
...
@@ -316,8 +316,8 @@ xer_decode_general(asn_codec_ctx_t *opt_codec_ctx,
}
in
t
xer_
is_
whitespace
(
const
void
*
chunk_buf
,
size_t
chunk_size
)
{
size_
t
xer_whitespace
_span
(
const
void
*
chunk_buf
,
size_t
chunk_size
)
{
const
char
*
p
=
(
const
char
*
)
chunk_buf
;
const
char
*
pend
=
p
+
chunk_size
;
...
...
@@ -330,12 +330,13 @@ xer_is_whitespace(const void *chunk_buf, size_t chunk_size) {
* SPACE (32)
*/
case
0x09
:
case
0x0a
:
case
0x0d
:
case
0x20
:
break
;
continue
;
default:
re
turn
0
;
b
re
ak
;
}
break
;
}
return
1
;
/* All whitespace */
return
(
p
-
(
const
char
*
)
chunk_buf
);
}
/*
...
...
skeletons/xer_decoder.h
View file @
f7982283
...
...
@@ -87,12 +87,11 @@ xer_check_tag_e xer_check_tag(const void *buf_ptr, int size,
const
char
*
need_tag
);
/*
*
Check whether this buffer
consist
s of
entirely XER whitespace characters.
*
Get the number of bytes
consist
ing
entirely
of
XER whitespace characters.
* RETURN VALUES:
* 1: Whitespace or empty string
* 0: Non-whitespace
* >=0: Number of whitespace characters in the string.
*/
in
t
xer_
is_
whitespace
(
const
void
*
chunk_buf
,
size_t
chunk_size
);
size_
t
xer_whitespace
_span
(
const
void
*
chunk_buf
,
size_t
chunk_size
);
/*
* Skip the series of anticipated extensions.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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