Avoid undefined behavior warning in GetArabicFormTable().
It would seem a recent roll has made UBSAN more particular about
the expression
g_FX_ArabicFormTables + unicode - 0x622
since the intermediate value following the addition but before the
subtraction is a pointer beyond the end of the g_FX_ArabicFormTables
object's address range.
Change-Id: Ie9d05686b11ff5914b90fc5d90967d9658a58e69
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/77310
Reviewed-by: Hui Yingst <nigi@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fgas/layout/fx_arabic.cpp b/xfa/fgas/layout/fx_arabic.cpp
index ddbfd20..9681b01 100644
--- a/xfa/fgas/layout/fx_arabic.cpp
+++ b/xfa/fgas/layout/fx_arabic.cpp
@@ -136,7 +136,7 @@
const FX_ARBFORMTABLE* GetArabicFormTable(wchar_t unicode) {
if (unicode < 0x622 || unicode > 0x6d5)
return nullptr;
- return g_FX_ArabicFormTables + unicode - 0x622;
+ return g_FX_ArabicFormTables + (unicode - 0x622);
}
const FX_ARBFORMTABLE* ParseChar(const CFX_Char* pTC,