An Egyptian court has voided a maritime border deal signed with Saudi Arabia that would hand over the control of two strategic Red Sea islands to Riyadh.