You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using pdfcpu version 0.6.0, which is the latest version as of my knowledge.
OS: Ubuntu 20.04
The issue occurs with PDFs that appear to have specific characteristics in their image encoding, not tied to a specific PDF writer.
Description
I encountered a runtime panic due to an "index out of range" error in the renderIndexedRGBToPNG function when trying to extract images from certain PDF files using pdfcpu. The panic suggests an access attempt outside the bounds of an array.
Steps to Reproduce
Use pdfcpu to extract images from a PDF that contains indexed color space images.
The panic occurs during the extraction process, specifically within the renderIndexedRGBToPNG function.
Expected Behavior
The function should handle the image data gracefully without causing a runtime panic, regardless of the specific content structure within the PDF.
Actual Behavior
A runtime panic occurs with the message: panic: runtime error: index out of range [31500] with length 31500.
Proposed Solution
I've modified the renderIndexedRGBToPNG function to include bounds checking for both the image content array and the lookup table. This adjustment successfully resolved the panic issue in my testing. Here's the modified function:
I am using
pdfcpu
version 0.6.0, which is the latest version as of my knowledge.OS: Ubuntu 20.04
The issue occurs with PDFs that appear to have specific characteristics in their image encoding, not tied to a specific PDF writer.
Description
I encountered a runtime panic due to an "index out of range" error in the
renderIndexedRGBToPNG
function when trying to extract images from certain PDF files usingpdfcpu
. The panic suggests an access attempt outside the bounds of an array.Steps to Reproduce
pdfcpu
to extract images from a PDF that contains indexed color space images.renderIndexedRGBToPNG
function.Expected Behavior
The function should handle the image data gracefully without causing a runtime panic, regardless of the specific content structure within the PDF.
Actual Behavior
A runtime panic occurs with the message:
panic: runtime error: index out of range [31500] with length 31500
.Proposed Solution
I've modified the
renderIndexedRGBToPNG
function to include bounds checking for both the image content array and the lookup table. This adjustment successfully resolved the panic issue in my testing. Here's the modified function:The text was updated successfully, but these errors were encountered: