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
33700165
Commit
33700165
authored
Oct 26, 2004
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
alpha64
parent
d7ad561a
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
32 additions
and
19 deletions
+32
-19
skeletons/INTEGER.c
skeletons/INTEGER.c
+6
-6
skeletons/OCTET_STRING.c
skeletons/OCTET_STRING.c
+3
-3
skeletons/REAL.c
skeletons/REAL.c
+5
-1
skeletons/ber_decoder.c
skeletons/ber_decoder.c
+2
-2
skeletons/ber_tlv_length.c
skeletons/ber_tlv_length.c
+2
-2
skeletons/tests/check-INTEGER.c
skeletons/tests/check-INTEGER.c
+2
-1
skeletons/tests/check-OCTET_STRING.c
skeletons/tests/check-OCTET_STRING.c
+1
-0
skeletons/tests/check-length.c
skeletons/tests/check-length.c
+10
-3
skeletons/xer_support.c
skeletons/xer_support.c
+1
-1
No files found.
skeletons/INTEGER.c
View file @
33700165
...
@@ -379,24 +379,24 @@ asn_long2INTEGER(INTEGER_t *st, long value) {
...
@@ -379,24 +379,24 @@ asn_long2INTEGER(INTEGER_t *st, long value) {
* a) shall not all be ones; and
* a) shall not all be ones; and
* b) shall not all be zero.
* b) shall not all be zero.
*/
*/
for
(
p
=
pstart
;
p
<
pend1
;
p
+=
add
)
{
for
(
p
=
pstart
;
p
!=
pend1
;
p
+=
add
)
{
switch
(
*
p
)
{
switch
(
*
p
)
{
case
0x00
:
if
((
p
[
1
]
&
0x80
)
==
0
)
case
0x00
:
if
((
*
(
p
+
add
)
&
0x80
)
==
0
)
continue
;
continue
;
break
;
break
;
case
0xff
:
if
((
p
[
1
]
&
0x80
))
case
0xff
:
if
((
*
(
p
+
add
)
&
0x80
))
continue
;
continue
;
break
;
break
;
}
}
break
;
break
;
}
}
/* Copy the integer body */
/* Copy the integer body */
for
(
pstart
=
p
,
bp
=
buf
;
p
<=
pend1
;
)
for
(
pstart
=
p
,
bp
=
buf
,
pend1
+=
add
;
p
!=
pend1
;
p
+=
add
)
*
bp
++
=
*
p
++
;
*
bp
++
=
*
p
;
if
(
st
->
buf
)
FREEMEM
(
st
->
buf
);
if
(
st
->
buf
)
FREEMEM
(
st
->
buf
);
st
->
buf
=
buf
;
st
->
buf
=
buf
;
st
->
size
=
p
-
pstart
;
st
->
size
=
bp
-
buf
;
return
0
;
return
0
;
}
}
skeletons/OCTET_STRING.c
View file @
33700165
...
@@ -914,8 +914,8 @@ static ssize_t OCTET_STRING__convert_binary(void *sptr, void *chunk_buf, size_t
...
@@ -914,8 +914,8 @@ static ssize_t OCTET_STRING__convert_binary(void *sptr, void *chunk_buf, size_t
* Something like strtod(), but with stricter rules.
* Something like strtod(), but with stricter rules.
*/
*/
static
int
static
int
OS__strtoent
(
int
base
,
char
*
buf
,
char
*
end
,
long
*
return_value
)
{
OS__strtoent
(
int
base
,
char
*
buf
,
char
*
end
,
int32_t
*
return_value
)
{
long
val
=
0
;
int32_t
val
=
0
;
char
*
p
;
char
*
p
;
for
(
p
=
buf
;
p
<
end
;
p
++
)
{
for
(
p
=
buf
;
p
<
end
;
p
++
)
{
...
@@ -981,7 +981,7 @@ static ssize_t OCTET_STRING__convert_entrefs(void *sptr, void *chunk_buf, size_t
...
@@ -981,7 +981,7 @@ static ssize_t OCTET_STRING__convert_entrefs(void *sptr, void *chunk_buf, size_t
if
(
len
==
1
/* "&" */
)
goto
want_more
;
if
(
len
==
1
/* "&" */
)
goto
want_more
;
if
(
p
[
1
]
==
0x23
/* '#' */
)
{
if
(
p
[
1
]
==
0x23
/* '#' */
)
{
char
*
pval
;
/* Pointer to start of digits */
char
*
pval
;
/* Pointer to start of digits */
long
val
;
/* Entity reference value */
int32_t
val
;
/* Entity reference value */
int
base
;
int
base
;
if
(
len
==
2
/* "&#" */
)
goto
want_more
;
if
(
len
==
2
/* "&#" */
)
goto
want_more
;
...
...
skeletons/REAL.c
View file @
33700165
...
@@ -2,12 +2,16 @@
...
@@ -2,12 +2,16 @@
* Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
* Redistribution and modifications are permitted subject to BSD license.
*/
*/
#if defined(__alpha)
#define _ISOC99_SOURCE
/* For quiet NAN, indirectly through bits/nan.h */
#define _BSD_SOURCE
/* To reintroduce finite(3) */
#endif
#include <asn_internal.h>
#include <asn_internal.h>
#include <REAL.h>
#include <stdlib.h>
/* for strtod(3) */
#include <stdlib.h>
/* for strtod(3) */
#include <math.h>
#include <math.h>
#include <errno.h>
#include <errno.h>
#include <assert.h>
#include <assert.h>
#include <REAL.h>
#undef INT_MAX
#undef INT_MAX
#define INT_MAX ((int)(((unsigned int)-1) >> 1))
#define INT_MAX ((int)(((unsigned int)-1) >> 1))
...
...
skeletons/ber_decoder.c
View file @
33700165
...
@@ -255,8 +255,8 @@ ber_check_tags(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -255,8 +255,8 @@ ber_check_tags(asn_codec_ctx_t *opt_codec_ctx,
* Inner TLV specifies length which is inconsistent
* Inner TLV specifies length which is inconsistent
* with the outer TLV's length value.
* with the outer TLV's length value.
*/
*/
ASN_DEBUG
(
"Outer TLV is %
d and inner is %
d"
,
ASN_DEBUG
(
"Outer TLV is %
ld and inner is %l
d"
,
limit_len
,
tlv_len
);
(
long
)
limit_len
,
(
long
)
tlv_len
);
RETURN
(
RC_FAIL
);
RETURN
(
RC_FAIL
);
}
}
...
...
skeletons/ber_tlv_length.c
View file @
33700165
...
@@ -54,8 +54,8 @@ ber_fetch_length(int _is_constructed, void *bufptr, size_t size,
...
@@ -54,8 +54,8 @@ ber_fetch_length(int _is_constructed, void *bufptr, size_t size,
/*
/*
* Here length may be very close or equal to 2G.
* Here length may be very close or equal to 2G.
* However, the arithmetics used in
other
decoders
* However, the arithmetics used in
some
decoders
*
often
add some (small) quantities to the length,
*
may
add some (small) quantities to the length,
* to check the resulting value against some limits.
* to check the resulting value against some limits.
* This may result in integer wrap-around.
* This may result in integer wrap-around.
*/
*/
...
...
skeletons/tests/check-INTEGER.c
View file @
33700165
...
@@ -44,6 +44,7 @@ check(uint8_t *buf, int size, long check_long, int check_ret) {
...
@@ -44,6 +44,7 @@ check(uint8_t *buf, int size, long check_long, int check_ret) {
printf
(
" (%ld, %d) vs (%ld, %d)
\n
"
,
printf
(
" (%ld, %d) vs (%ld, %d)
\n
"
,
rlong
,
ret
,
check_long
,
check_ret
);
rlong
,
ret
,
check_long
,
check_ret
);
assert
(
ret
==
check_ret
);
assert
(
ret
==
check_ret
);
printf
(
"%ld %ld
\n
"
,
rlong
,
check_long
);
assert
(
rlong
==
check_long
);
assert
(
rlong
==
check_long
);
if
(
check_ret
==
0
)
{
if
(
check_ret
==
0
)
{
...
@@ -134,7 +135,7 @@ main(int ac, char **av) {
...
@@ -134,7 +135,7 @@ main(int ac, char **av) {
CHECK
(
buf8
,
0x7F7E7D7C
,
0
);
CHECK
(
buf8
,
0x7F7E7D7C
,
0
);
CHECK
(
buf9
,
0x7F7E7D7C
,
0
);
CHECK
(
buf9
,
0x7F7E7D7C
,
0
);
CHECK
(
buf10
,
0x7F7E7D7C
,
0
);
CHECK
(
buf10
,
0x7F7E7D7C
,
0
);
CHECK
(
buf11
,
0x80000000
,
0
);
CHECK
(
buf11
,
-
2147483648
,
0
);
/* 0x80000000 */
CHECK
(
buf12
,
-
32768
,
0
);
CHECK
(
buf12
,
-
32768
,
0
);
CHECK
(
buf13
,
-
128
,
0
);
CHECK
(
buf13
,
-
128
,
0
);
...
...
skeletons/tests/check-OCTET_STRING.c
View file @
33700165
...
@@ -89,6 +89,7 @@ main() {
...
@@ -89,6 +89,7 @@ main() {
check
(
UTF8
,
"z"
,
"<z z z>a b</z z z>"
,
"a b"
);
check
(
UTF8
,
"z"
,
"<z z z>a b</z z z>"
,
"a b"
);
check
(
UTF8
,
"z"
,
"<z>a繃b</z>"
,
"a
\347\271\203
b"
);
check
(
UTF8
,
"z"
,
"<z>a繃b</z>"
,
"a
\347\271\203
b"
);
check
(
UTF8
,
"z"
,
"<z>a�b</z>"
,
"a�b"
);
check
(
UTF8
,
"z"
,
"<z>a�b</z>"
,
"a�b"
);
check
(
UTF8
,
"z"
,
"<z>a�b</z>"
,
"a�b"
);
check
(
UTF8
,
"z"
,
"<z>aĬ</z>"
,
"aĬ"
);
check
(
UTF8
,
"z"
,
"<z>aĬ</z>"
,
"aĬ"
);
check
(
UTF8
,
"z"
,
"<z>a&#-300;</z>"
,
"a&#-300;"
);
check
(
UTF8
,
"z"
,
"<z>a&#-300;</z>"
,
"a&#-300;"
);
check
(
UTF8
,
"z"
,
"<z>a<ff/>b</z>"
,
"a
\014
b"
);
check
(
UTF8
,
"z"
,
"<z>a<ff/>b</z>"
,
"a
\014
b"
);
...
...
skeletons/tests/check-length.c
View file @
33700165
...
@@ -87,6 +87,7 @@ main() {
...
@@ -87,6 +87,7 @@ main() {
uint8_t
buf1
[]
=
{
0x85
,
0x00
,
0x01
,
0x02
,
0x03
,
0x04
};
uint8_t
buf1
[]
=
{
0x85
,
0x00
,
0x01
,
0x02
,
0x03
,
0x04
};
uint8_t
buf2
[]
=
{
0x85
,
0x00
,
0x7f
,
0xff
,
0x03
,
0x04
};
uint8_t
buf2
[]
=
{
0x85
,
0x00
,
0x7f
,
0xff
,
0x03
,
0x04
};
uint8_t
buf3
[]
=
{
0x85
,
0x00
,
0x7f
,
0xff
,
0xff
,
0x04
};
uint8_t
buf3
[]
=
{
0x85
,
0x00
,
0x7f
,
0xff
,
0xff
,
0x04
};
uint8_t
buf4
[]
=
{
0x89
,
0x00
,
0x7f
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0x04
};
ber_tlv_len_t
tlv_len
;
ber_tlv_len_t
tlv_len
;
ssize_t
ret
;
ssize_t
ret
;
int
i
;
int
i
;
...
@@ -104,9 +105,15 @@ main() {
...
@@ -104,9 +105,15 @@ main() {
printf
(
"ret=%ld, len=%ld
\n
"
,
(
long
)
ret
,
(
long
)
tlv_len
);
printf
(
"ret=%ld, len=%ld
\n
"
,
(
long
)
ret
,
(
long
)
tlv_len
);
assert
(
ret
==
sizeof
(
buf2
));
assert
(
ret
==
sizeof
(
buf2
));
ret
=
ber_fetch_length
(
0
,
buf3
,
sizeof
(
buf3
),
&
tlv_len
);
if
(
sizeof
(
tlv_len
)
==
4
)
{
printf
(
"ret=%ld
\n
"
,
(
long
)
ret
);
ret
=
ber_fetch_length
(
0
,
buf3
,
sizeof
(
buf3
),
&
tlv_len
);
assert
(
ret
==
-
1
);
printf
(
"ret=%ld
\n
"
,
(
long
)
ret
);
assert
(
ret
==
-
1
);
}
else
if
(
sizeof
(
tlv_len
)
==
8
)
{
ret
=
ber_fetch_length
(
0
,
buf4
,
sizeof
(
buf4
),
&
tlv_len
);
printf
(
"ret=%ld
\n
"
,
(
long
)
ret
);
assert
(
ret
==
-
1
);
}
return
0
;
return
0
;
}
}
skeletons/xer_support.c
View file @
33700165
...
@@ -88,7 +88,7 @@ _charclass[256] = {
...
@@ -88,7 +88,7 @@ _charclass[256] = {
/*
/*
* Parser itself
* Parser itself
*/
*/
in
t
pxml_parse
(
int
*
stateContext
,
void
*
xmlbuf
,
size_t
size
,
pxml_callback_f
*
cb
,
void
*
key
)
{
ssize_
t
pxml_parse
(
int
*
stateContext
,
void
*
xmlbuf
,
size_t
size
,
pxml_callback_f
*
cb
,
void
*
key
)
{
pstate_e
state
=
(
pstate_e
)
*
stateContext
;
pstate_e
state
=
(
pstate_e
)
*
stateContext
;
char
*
chunk_start
=
(
char
*
)
xmlbuf
;
char
*
chunk_start
=
(
char
*
)
xmlbuf
;
char
*
p
=
chunk_start
;
char
*
p
=
chunk_start
;
...
...
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