mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-18 06:30:14 +08:00
Merge pull request #920 from stweil/fix
Improve robustness of TessdataManager
This commit is contained in:
commit
2a4483da4c
@ -54,6 +54,7 @@ bool TessdataManager::LoadMemBuffer(const char *name, const char *data,
|
||||
swap_ = num_entries > kMaxNumTessdataEntries || num_entries < 0;
|
||||
fp.set_swap(swap_);
|
||||
if (swap_) ReverseN(&num_entries, sizeof(num_entries));
|
||||
if (num_entries > kMaxNumTessdataEntries || num_entries < 0) return false;
|
||||
GenericVector<inT64> offset_table;
|
||||
offset_table.resize_no_init(num_entries);
|
||||
if (fp.FReadEndian(&offset_table[0], sizeof(offset_table[0]), num_entries) !=
|
||||
|
Loading…
Reference in New Issue
Block a user