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
0368c628
Commit
0368c628
authored
7 years ago
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get rid of undefined behavior sanitizer warnings
parent
e835b3ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
10 deletions
+21
-10
skeletons/OCTET_STRING.c
skeletons/OCTET_STRING.c
+20
-9
skeletons/asn_bit_data.c
skeletons/asn_bit_data.c
+1
-1
No files found.
skeletons/OCTET_STRING.c
View file @
0368c628
...
...
@@ -19,11 +19,7 @@ asn_OCTET_STRING_specifics_t asn_SPC_OCTET_STRING_specs = {
offsetof
(
OCTET_STRING_t
,
_asn_ctx
),
ASN_OSUBV_STR
};
static
asn_per_constraints_t
asn_DEF_OCTET_STRING_constraints
=
{
{
APC_CONSTRAINED
,
8
,
8
,
0
,
255
},
{
APC_SEMI_CONSTRAINED
,
-
1
,
-
1
,
0
,
0
},
0
,
0
};
asn_TYPE_operation_t
asn_OP_OCTET_STRING
=
{
OCTET_STRING_free
,
OCTET_STRING_print
,
/* OCTET STRING generally means a non-ascii sequence */
...
...
@@ -510,9 +506,18 @@ OCTET_STRING_decode_ber(const asn_codec_ctx_t *opt_codec_ctx,
/*
* BIT STRING-specific processing.
*/
if
(
type_variant
==
ASN_OSUBV_BIT
&&
st
->
size
)
{
/* Finalize BIT STRING: zero out unused bits. */
st
->
buf
[
st
->
size
-
1
]
&=
0xff
<<
st
->
bits_unused
;
if
(
type_variant
==
ASN_OSUBV_BIT
)
{
if
(
st
->
size
)
{
if
(
st
->
bits_unused
<
0
||
st
->
bits_unused
>
7
)
{
RETURN
(
RC_FAIL
);
}
/* Finalize BIT STRING: zero out unused bits. */
st
->
buf
[
st
->
size
-
1
]
&=
0xff
<<
st
->
bits_unused
;
}
else
{
if
(
st
->
bits_unused
)
{
RETURN
(
RC_FAIL
);
}
}
}
ASN_DEBUG
(
"Took %ld bytes to encode %s: [%s]:%ld"
,
...
...
@@ -1208,6 +1213,8 @@ OCTET_STRING_decode_xer_utf8(const asn_codec_ctx_t *opt_codec_ctx,
OCTET_STRING__convert_entrefs
);
}
#ifndef ASN_DISABLE_PER_SUPPORT
static
int
OCTET_STRING_per_get_characters
(
asn_per_data_t
*
po
,
uint8_t
*
buf
,
size_t
units
,
unsigned
int
bpc
,
unsigned
int
unit_bits
,
...
...
@@ -1337,7 +1344,11 @@ OCTET_STRING_per_put_characters(asn_per_outp_t *po, const uint8_t *buf,
return
0
;
}
#ifndef ASN_DISABLE_PER_SUPPORT
static
asn_per_constraints_t
asn_DEF_OCTET_STRING_constraints
=
{
{
APC_CONSTRAINED
,
8
,
8
,
0
,
255
},
{
APC_SEMI_CONSTRAINED
,
-
1
,
-
1
,
0
,
0
},
0
,
0
};
asn_dec_rval_t
OCTET_STRING_decode_uper
(
const
asn_codec_ctx_t
*
opt_codec_ctx
,
...
...
This diff is collapsed.
Click to expand it.
skeletons/asn_bit_data.c
View file @
0368c628
...
...
@@ -292,7 +292,7 @@ asn_put_aligned_flush(asn_bit_outp_t *po) {
(
po
->
buffer
?
po
->
buffer
-
po
->
tmpspace
:
0
)
+
((
po
->
nboff
+
7
)
>>
3
);
if
(
unused_bits
)
{
po
->
buffer
[
po
->
nboff
>>
3
]
&=
~
0
<<
unused_bits
;
po
->
buffer
[
po
->
nboff
>>
3
]
&=
~
0
u
<<
unused_bits
;
}
if
(
po
->
output
(
po
->
tmpspace
,
complete_bytes
,
po
->
op_key
)
<
0
)
{
...
...
This diff is collapsed.
Click to expand it.
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