Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
doxverilog
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
doxverilog
Commits
e5076edf
Commit
e5076edf
authored
Nov 02, 2014
by
Dimitri van Heesch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed issue accessing uninitialized data when combining RTF output.
parent
c83db38e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
rtfgen.cpp
src/rtfgen.cpp
+6
-5
No files found.
src/rtfgen.cpp
View file @
e5076edf
...
@@ -2268,11 +2268,12 @@ bool isLeadBytes(int c)
...
@@ -2268,11 +2268,12 @@ bool isLeadBytes(int c)
// note: function is not reentrant!
// note: function is not reentrant!
static
void
encodeForOutput
(
FTextStream
&
t
,
const
QCString
&
s
)
static
void
encodeForOutput
(
FTextStream
&
t
,
const
char
*
s
)
{
{
if
(
s
==
0
)
return
;
QCString
encoding
;
QCString
encoding
;
bool
converted
=
FALSE
;
bool
converted
=
FALSE
;
int
l
=
s
.
length
(
);
int
l
=
qstrlen
(
s
);
static
QByteArray
enc
;
static
QByteArray
enc
;
if
(
l
*
4
>
(
int
)
enc
.
size
())
enc
.
resize
(
l
*
4
);
// worst case
if
(
l
*
4
>
(
int
)
enc
.
size
())
enc
.
resize
(
l
*
4
);
// worst case
encoding
.
sprintf
(
"CP%s"
,
theTranslator
->
trRTFansicp
().
data
());
encoding
.
sprintf
(
"CP%s"
,
theTranslator
->
trRTFansicp
().
data
());
...
@@ -2284,7 +2285,7 @@ static void encodeForOutput(FTextStream &t,const QCString &s)
...
@@ -2284,7 +2285,7 @@ static void encodeForOutput(FTextStream &t,const QCString &s)
{
{
size_t
iLeft
=
l
;
size_t
iLeft
=
l
;
size_t
oLeft
=
enc
.
size
();
size_t
oLeft
=
enc
.
size
();
char
*
inputPtr
=
s
.
data
()
;
char
*
inputPtr
=
(
char
*
)
s
;
char
*
outputPtr
=
enc
.
data
();
char
*
outputPtr
=
enc
.
data
();
if
(
!
portable_iconv
(
cd
,
&
inputPtr
,
&
iLeft
,
&
outputPtr
,
&
oLeft
))
if
(
!
portable_iconv
(
cd
,
&
inputPtr
,
&
iLeft
,
&
outputPtr
,
&
oLeft
))
{
{
...
@@ -2296,7 +2297,7 @@ static void encodeForOutput(FTextStream &t,const QCString &s)
...
@@ -2296,7 +2297,7 @@ static void encodeForOutput(FTextStream &t,const QCString &s)
}
}
if
(
!
converted
)
// if we did not convert anything, copy as is.
if
(
!
converted
)
// if we did not convert anything, copy as is.
{
{
memcpy
(
enc
.
data
(),
s
.
data
()
,
l
);
memcpy
(
enc
.
data
(),
s
,
l
);
enc
.
resize
(
l
);
enc
.
resize
(
l
);
}
}
uint
i
;
uint
i
;
...
@@ -2355,7 +2356,7 @@ static bool preProcessFile(QDir &d,QCString &infName, FTextStream &t, bool bIncl
...
@@ -2355,7 +2356,7 @@ static bool preProcessFile(QDir &d,QCString &infName, FTextStream &t, bool bIncl
err
(
"read error in %s before end of RTF header!
\n
"
,
infName
.
data
());
err
(
"read error in %s before end of RTF header!
\n
"
,
infName
.
data
());
return
FALSE
;
return
FALSE
;
}
}
if
(
bIncludeHeader
)
encodeForOutput
(
t
,
lineBuf
);
if
(
bIncludeHeader
)
encodeForOutput
(
t
,
lineBuf
.
data
()
);
}
while
(
lineBuf
.
find
(
"
\\
comment begin body"
)
==-
1
);
}
while
(
lineBuf
.
find
(
"
\\
comment begin body"
)
==-
1
);
...
...
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