Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
f2e1d207
Commit
f2e1d207
authored
Jul 12, 2022
by
Pau Espin Pedrol
Committed by
Mouse
Jul 12, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aper: Fix encoding OCTET_STRING with constrained size
parent
798a79fb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
7 deletions
+4
-7
skeletons/OCTET_STRING_aper.c
skeletons/OCTET_STRING_aper.c
+2
-2
tests/tests-skeletons/check-APER-OCTET_STRING.c
tests/tests-skeletons/check-APER-OCTET_STRING.c
+2
-5
No files found.
skeletons/OCTET_STRING_aper.c
View file @
f2e1d207
...
...
@@ -345,7 +345,7 @@ OCTET_STRING_encode_aper(const asn_TYPE_descriptor_t *td,
ret
=
aper_put_length
(
po
,
csiz
->
upper_bound
-
csiz
->
lower_bound
+
1
,
sizeinunits
-
csiz
->
lower_bound
,
0
);
if
(
ret
)
ASN__ENCODE_FAILED
;
if
(
ret
<
0
)
ASN__ENCODE_FAILED
;
}
if
(
csiz
->
effective_bits
>
0
||
(
st
->
size
>
2
)
||
(
csiz
->
upper_bound
>
(
2
*
8
/
unit_bits
))
...
...
@@ -372,7 +372,7 @@ OCTET_STRING_encode_aper(const asn_TYPE_descriptor_t *td,
ASN_DEBUG
(
"Encoding %lu bytes"
,
st
->
size
);
if
(
sizeinunits
==
0
)
{
if
(
aper_put_length
(
po
,
-
1
,
0
,
0
))
if
(
aper_put_length
(
po
,
-
1
,
0
,
0
)
<
0
)
ASN__ENCODE_FAILED
;
ASN__ENCODED_OK
(
er
);
}
...
...
tests/tests-skeletons/check-APER-OCTET_STRING.c
View file @
f2e1d207
...
...
@@ -32,9 +32,8 @@ encode_constrained_size(char *orig, char *encoded, long lbound, unsigned long ub
asn_enc_rval_t
er
;
struct
asn_per_constraints_s
cts
;
asn_per_outp_t
po
;
#if 0
char
*
out_str
;
#endif
memset
(
&
os
,
0
,
sizeof
(
os
));
OCTET_STRING_fromString
(
&
os
,
orig
);
...
...
@@ -60,8 +59,7 @@ encode_constrained_size(char *orig, char *encoded, long lbound, unsigned long ub
er
=
OCTET_STRING_encode_aper
(
&
asn_DEF_OCTET_STRING
,
&
cts
,
&
os
,
&
po
);
assert
(
er
.
encoded
<
0
);
/* BUG! it should be >= 0 */
#if 0
assert
(
er
.
encoded
>=
0
);
unsigned
l
=
(
po
.
buffer
-
po
.
tmpspace
)
+
(
po
.
nboff
+
7
)
/
8
;
memcpy
(
&
buf
[
er
.
encoded
],
po
.
tmpspace
,
l
);
er
.
encoded
+=
l
;
...
...
@@ -72,7 +70,6 @@ encode_constrained_size(char *orig, char *encoded, long lbound, unsigned long ub
printf
(
"Orig: [%s], encoded: [%s], check [%s]
\n
"
,
orig
,
out_str
,
encoded
);
assert
(
strcmp
(
out_str
,
encoded
)
==
0
);
#endif
ASN_STRUCT_RESET
(
asn_DEF_OCTET_STRING
,
&
os
);
}
...
...
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