Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PacketLib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andrea Bulgarelli
PacketLib
Commits
7d130612
Commit
7d130612
authored
11 years ago
by
Andrea Bulgarelli
Browse files
Options
Downloads
Patches
Plain Diff
added exception generation if LZ4 decompression has problems
parent
ae3ba7a0
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ByteStream.cpp
+5
-1
5 additions, 1 deletion
src/ByteStream.cpp
with
5 additions
and
1 deletion
src/ByteStream.cpp
+
5
−
1
View file @
7d130612
...
@@ -177,10 +177,14 @@ ByteStreamPtr PacketLib::ByteStream::decompress(enum CompressionAlgorithms algor
...
@@ -177,10 +177,14 @@ ByteStreamPtr PacketLib::ByteStream::decompress(enum CompressionAlgorithms algor
int
buffsize
=
LZ4_decompress_safe
((
const
char
*
)
stream
,
(
char
*
)
tmpbuff
,
size
(),
dmax
);
int
buffsize
=
LZ4_decompress_safe
((
const
char
*
)
stream
,
(
char
*
)
tmpbuff
,
size
(),
dmax
);
if
(
!
buffsize
)
if
(
!
buffsize
)
{
{
cout
<<
"LZ4 decompression error"
<<
endl
;
delete
tmpbuff
;
delete
tmpbuff
;
throw
new
PacketException
(
"LZ4 decompression error"
);
return
0
;
return
0
;
}
}
if
(
buffsize
<
0
)
{
delete
tmpbuff
;
throw
new
PacketException
(
"LZ4 decompression error: the source stream is malformed"
);
}
byte
*
decompbuff
=
new
byte
[
buffsize
];
byte
*
decompbuff
=
new
byte
[
buffsize
];
memcpy
(
decompbuff
,
tmpbuff
,
buffsize
);
memcpy
(
decompbuff
,
tmpbuff
,
buffsize
);
b
=
ByteStreamPtr
(
new
ByteStream
(
decompbuff
,
buffsize
,
bigendian
));
b
=
ByteStreamPtr
(
new
ByteStream
(
decompbuff
,
buffsize
,
bigendian
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment