Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e2470ce8 authored by Hall Liu's avatar Hall Liu
Browse files

Make a copy of the sSlotIndexToSubId's entryset

If sSlotIndexToSubId is modified on another thread between simInfoSet
being initialized and the iteration, the sizes may not match and an
array-out-of-bounds error may occur.

Change-Id: If1ed9678d5652f1e3161a7a29d34c047daa8e469
Test: builds
Fixes: 63715198
parent 766ccbc7
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -1642,7 +1643,7 @@ public class SubscriptionController extends ISub.Stub {
     */
    @Override
    public int[] getActiveSubIdList() {
        Set<Entry<Integer, Integer>> simInfoSet = sSlotIndexToSubId.entrySet();
        Set<Entry<Integer, Integer>> simInfoSet = new HashSet<>(sSlotIndexToSubId.entrySet());

        int[] subIdArr = new int[simInfoSet.size()];
        int i = 0;