Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lvrend: fix possible buffer overflow #613

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions crengine/src/lvrend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12273,9 +12273,8 @@ void getRenderedWidths(ldomNode * node, int &maxWidth, int &minWidth, int direct
printf("GRW text: |%s|\n", UnicodeToLocal(text).c_str());
printf("GRW text: (dumb text size=%d)\n", font->getTextWidth(txt, len));
#endif
#define MAX_TEXT_CHUNK_SIZE 4096
static lUInt16 widths[MAX_TEXT_CHUNK_SIZE+1];
static lUInt8 flags[MAX_TEXT_CHUNK_SIZE+1];
lUInt16 *widths = new lUInt16[len];
lUInt8 *flags = new lUInt8[len];

// todo: use fribidi and split measurement at fribidi level change,
// and beware left/right side bearing adjustments...
Expand Down Expand Up @@ -12527,6 +12526,8 @@ void getRenderedWidths(ldomNode * node, int &maxWidth, int &minWidth, int direct
len -= chars_measured;
start += chars_measured;
}
delete [] widths;
delete [] flags;
}
#ifdef DEBUG_GETRENDEREDWIDTHS
printf("GRW current: max=%d word=%d (max=%d, min=%d)\n", curMaxWidth, curWordWidth, maxWidth, minWidth);
Expand Down
Loading