• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/ucode/tests/custom/99_bugs/48_use_after_free_on_iteration_insert

  1 Ensure that adding keys to an object currently being iterated will not
  2 clobber active iterators pointing into that object due to a reallocation
  3 of the underlying hash table array.
  4 
  5 -- Testcase --
  6 {%
  7         let obj = { '0': 0, '1': 1 };
  8         let i = 2;
  9 
 10         for (let k, v in obj) {
 11                 while (i < 16) {
 12                         obj[i] = i;
 13                         i++;
 14                 }
 15         }
 16 
 17         printf("%.J\n", obj);
 18 %}
 19 -- End --
 20 
 21 -- Expect stdout --
 22 {
 23         "0": 0,
 24         "1": 1,
 25         "2": 2,
 26         "3": 3,
 27         "4": 4,
 28         "5": 5,
 29         "6": 6,
 30         "7": 7,
 31         "8": 8,
 32         "9": 9,
 33         "10": 10,
 34         "11": 11,
 35         "12": 12,
 36         "13": 13,
 37         "14": 14,
 38         "15": 15
 39 }
 40 -- End --

This page was automatically generated by LXR 0.3.1.  •  OpenWrt