b***@artifex.com
2017-10-02 16:13:03 UTC
http://bugs.ghostscript.com/show_bug.cgi?id=698616
Bug ID: 698616
Summary: Page_textAsHtml function of mupdf_native.c returns
corrupted output
Product: MuPDF
Version: master
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: P4
Component: mupdf
Assignee: mupdf-***@artifex.com
Reporter: ***@telenet.be
QA Contact: gs-***@ghostscript.com
Word Size: ---
The function Page_textAsHtml from mupdf_native.c returns a byte array where the
beginning of the text is corrupt.
The reason for this corruption is because the buffer to create the java byte
array is being freed before it is used.
So the following code:
arr = (*env)->NewByteArray(env, (jsize)len);
fz_drop_buffer(ctx, buf);
if (!arr) return NULL;
(*env)->SetByteArrayRegion(env, arr, 0, (jsize)len, (jbyte *)data);
Needs to be:
arr = (*env)->NewByteArray(env, (jsize)len);
if (!arr)
{
fz_drop_buffer(ctx, buf);
return NULL;
}
(*env)->SetByteArrayRegion(env, arr, 0, (jsize)len, (jbyte *)data);
fz_drop_buffer(ctx, buf);
Bug ID: 698616
Summary: Page_textAsHtml function of mupdf_native.c returns
corrupted output
Product: MuPDF
Version: master
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: P4
Component: mupdf
Assignee: mupdf-***@artifex.com
Reporter: ***@telenet.be
QA Contact: gs-***@ghostscript.com
Word Size: ---
The function Page_textAsHtml from mupdf_native.c returns a byte array where the
beginning of the text is corrupt.
The reason for this corruption is because the buffer to create the java byte
array is being freed before it is used.
So the following code:
arr = (*env)->NewByteArray(env, (jsize)len);
fz_drop_buffer(ctx, buf);
if (!arr) return NULL;
(*env)->SetByteArrayRegion(env, arr, 0, (jsize)len, (jbyte *)data);
Needs to be:
arr = (*env)->NewByteArray(env, (jsize)len);
if (!arr)
{
fz_drop_buffer(ctx, buf);
return NULL;
}
(*env)->SetByteArrayRegion(env, arr, 0, (jsize)len, (jbyte *)data);
fz_drop_buffer(ctx, buf);
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are receiving this mail because:
You are the QA Contact for the bug.