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 / Register
Toggle navigation
Open sidebar
Christian Persch
poppler
Commits
c3a2c11a
Commit
c3a2c11a
authored
Oct 21, 2018
by
Albert Astals Cid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stream::makeFilter: Fix memory leak
fixes oss-fuzz/9614
parent
d0ab87c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
1 deletion
+26
-1
poppler/Stream.cc
poppler/Stream.cc
+26
-1
No files found.
poppler/Stream.cc
View file @
c3a2c11a
...
...
@@ -180,6 +180,31 @@ Stream *Stream::addFilters(Dict *dict, int recursion) {
return
str
;
}
class
BaseStreamStream
:
public
Stream
{
public:
BaseStreamStream
(
Stream
*
strA
)
:
str
(
strA
)
{
}
StreamKind
getKind
()
override
{
return
str
->
getBaseStream
()
->
getKind
();
}
void
reset
()
override
{
str
->
getBaseStream
()
->
reset
();
}
int
getChar
()
override
{
return
str
->
getBaseStream
()
->
getChar
();
}
int
lookChar
()
override
{
return
str
->
getBaseStream
()
->
lookChar
();
}
bool
isBinary
(
bool
last
=
true
)
override
{
return
str
->
getBaseStream
()
->
isBinary
();
}
int
getUnfilteredChar
()
override
{
return
str
->
getBaseStream
()
->
getUnfilteredChar
();
}
void
unfilteredReset
()
override
{
str
->
getBaseStream
()
->
unfilteredReset
();
}
Goffset
getPos
()
override
{
return
str
->
getBaseStream
()
->
getPos
();
}
void
setPos
(
Goffset
pos
,
int
dir
)
override
{
str
->
getBaseStream
()
->
setPos
(
pos
,
dir
);
}
BaseStream
*
getBaseStream
()
override
{
return
str
->
getBaseStream
()
->
getBaseStream
();
}
Stream
*
getUndecodedStream
()
override
{
return
str
->
getBaseStream
()
->
getUndecodedStream
();
}
Dict
*
getDict
()
override
{
return
str
->
getBaseStream
()
->
getDict
();
}
Object
*
getDictObject
()
override
{
return
str
->
getBaseStream
()
->
getDictObject
();
}
private:
std
::
unique_ptr
<
Stream
>
str
;
};
Stream
*
Stream
::
makeFilter
(
const
char
*
name
,
Stream
*
str
,
Object
*
params
,
int
recursion
,
Dict
*
dict
)
{
int
pred
;
// parameters
int
colors
;
...
...
@@ -315,7 +340,7 @@ Stream *Stream::makeFilter(const char *name, Stream *str, Object *params, int re
#endif
}
else
if
(
!
strcmp
(
name
,
"Crypt"
))
{
if
(
str
->
getKind
()
==
strCrypt
)
{
str
=
str
->
getBase
Stream
();
str
=
new
BaseStream
Stream
(
str
);
}
else
{
error
(
errSyntaxError
,
getPos
(),
"Can't revert non decrypt streams"
);
}
...
...
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