Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Mathis Rosenhauer
libaec
Commits
b03cbf30
Commit
b03cbf30
authored
Aug 10, 2012
by
Mathis Rosenhauer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed space checking and not understood buffer overrun
parent
32237e59
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
5 deletions
+11
-5
src/Makefile
src/Makefile
+1
-1
src/aed.c
src/aed.c
+5
-1
src/aee.c
src/aee.c
+1
-1
src/sz_compat.c
src/sz_compat.c
+4
-2
No files found.
src/Makefile
View file @
b03cbf30
CC
=
gcc
#CFLAGS = -g -pg -lc -O2 -Wall -fprofile-arcs -ftest-coverage -DPROFILE
#CFLAGS = -g -pg -lc -O2 -Wall -fprofile-arcs -ftest-coverage -DUNROLL_BLOCK_8
CFLAGS
=
-g
-O
3
-Wall
-DUNROLL_BLOCK_8
CFLAGS
=
-g
-O
0
-Wall
-DUNROLL_BLOCK_8
OBJS
=
aee.o aed.o sz_compat.o
...
...
src/aed.c
View file @
b03cbf30
...
...
@@ -12,7 +12,7 @@
#define MIN(a, b) (((a) < (b))? (a): (b))
#define SAFE (strm->avail_in >= state->in_blklen \
&& strm->avail_out >= st
rm->block_size
)
&& strm->avail_out >= st
ate->out_blklen
)
#define ROS 5
...
...
@@ -28,6 +28,7 @@ typedef struct internal_state {
int
mode
;
/* current mode of FSM */
int
in_blklen
;
/* length of uncompressed input block
should be the longest possible block */
int
out_blklen
;
/* length of output block in bytes */
int
n
,
i
;
/* counter for samples */
int64_t
*
block
;
/* block buffer for split-sample options */
int
se
;
/* set if second extension option is selected */
...
...
@@ -263,6 +264,7 @@ int ae_decode_init(ae_streamp strm)
if
(
strm
->
bit_per_sample
>
16
)
{
state
->
id_len
=
5
;
state
->
out_blklen
=
strm
->
block_size
*
4
;
if
(
strm
->
flags
&
AE_DATA_MSB
)
state
->
put_sample
=
put_msb_32
;
else
...
...
@@ -271,6 +273,7 @@ int ae_decode_init(ae_streamp strm)
else
if
(
strm
->
bit_per_sample
>
8
)
{
state
->
id_len
=
4
;
state
->
out_blklen
=
strm
->
block_size
*
2
;
if
(
strm
->
flags
&
AE_DATA_MSB
)
state
->
put_sample
=
put_msb_16
;
else
...
...
@@ -279,6 +282,7 @@ int ae_decode_init(ae_streamp strm)
else
{
state
->
id_len
=
3
;
state
->
out_blklen
=
strm
->
block_size
;
state
->
put_sample
=
put_8
;
}
...
...
src/aee.c
View file @
b03cbf30
...
...
@@ -182,7 +182,7 @@ int ae_encode_init(ae_streamp strm)
}
blklen
=
(
strm
->
block_size
*
strm
->
bit_per_sample
+
state
->
id_len
)
/
8
+
2
;
+
state
->
id_len
)
/
8
+
16
;
state
->
block_out
=
(
uint8_t
*
)
malloc
(
blklen
);
if
(
state
->
block_out
==
NULL
)
...
...
src/sz_compat.c
View file @
b03cbf30
...
...
@@ -21,10 +21,11 @@ int SZ_BufftoBuffCompress(void *dest, size_t *destLen, const void *source, size_
if
((
status
=
ae_encode
(
&
strm
,
AE_FLUSH
))
!=
AE_OK
)
return
status
;
*
destLen
=
strm
.
total_out
;
if
((
status
=
ae_encode_end
(
&
strm
))
!=
AE_OK
)
return
status
;
*
destLen
=
strm
.
total_out
;
return
SZ_OK
;
}
...
...
@@ -48,9 +49,10 @@ int SZ_BufftoBuffDecompress(void *dest, size_t *destLen, const void *source, siz
if
((
status
=
ae_decode
(
&
strm
,
AE_FLUSH
))
!=
AE_OK
)
return
status
;
*
destLen
=
strm
.
total_out
;
if
((
status
=
ae_decode_end
(
&
strm
))
!=
AE_OK
)
return
status
;
*
destLen
=
strm
.
total_out
;
return
SZ_OK
;
}
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