FLEX-33710: Added index bounds checks.