--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/Features.cpp Wed Apr 15 13:15:16 2015 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/Features.cpp Thu Apr 16 11:27:23 2015 +0300
@@ -41,7 +41,7 @@
LEReferenceTo<FeatureTable> FeatureListTable::getFeatureTable(const LETableReference &base, le_uint16 featureIndex, LETag *featureTag, LEErrorCode &success) const
{
LEReferenceToArrayOf<FeatureRecord>
- featureRecordArrayRef(base, success, featureRecordArray, featureIndex);
+ featureRecordArrayRef(base, success, featureRecordArray, featureIndex+1);
if (featureIndex >= SWAPW(featureCount) || LE_FAILURE(success)) {
return LEReferenceTo<FeatureTable>();
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/LETableReference.h Wed Apr 15 13:15:16 2015 +0300
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/LETableReference.h Thu Apr 16 11:27:23 2015 +0300
@@ -240,6 +240,18 @@
}
/**
+ * Throw an error if size*count overflows
+ */
+ size_t verifyLength(size_t offset, size_t size, le_uint32 count, LEErrorCode &success) {
+ if(count!=0 && size>LE_UINT32_MAX/count) {
+ LE_DEBUG_TR3("verifyLength failed size=%u, count=%u", size, count);
+ success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
+ return 0;
+ }
+ return verifyLength(offset, size*count, success);
+ }
+
+ /**
* Change parent link to another
*/
LETableReference &reparent(const LETableReference &base) {
@@ -424,7 +436,7 @@
if(fCount == LE_UNBOUNDED_ARRAY) { // not a known length
fCount = getLength()/LETableVarSizer<T>::getSize(); // fit to max size
}
- LETableReference::verifyLength(0, LETableVarSizer<T>::getSize()*fCount, success);
+ LETableReference::verifyLength(0, LETableVarSizer<T>::getSize(), fCount, success);
}
if(LE_FAILURE(success)) {
fCount=0;
@@ -439,7 +451,7 @@
if(fCount == LE_UNBOUNDED_ARRAY) { // not a known length
fCount = getLength()/LETableVarSizer<T>::getSize(); // fit to max size
}
- LETableReference::verifyLength(0, LETableVarSizer<T>::getSize()*fCount, success);
+ LETableReference::verifyLength(0, LETableVarSizer<T>::getSize(), fCount, success);
}
if(LE_FAILURE(success)) clear();
}
@@ -450,7 +462,7 @@
if(fCount == LE_UNBOUNDED_ARRAY) { // not a known length
fCount = getLength()/LETableVarSizer<T>::getSize(); // fit to max size
}
- LETableReference::verifyLength(0, LETableVarSizer<T>::getSize()*fCount, success);
+ LETableReference::verifyLength(0, LETableVarSizer<T>::getSize(), fCount, success);
}
if(LE_FAILURE(success)) clear();
}