)]}'
{
  "commit": "c057ed9c52c6a63a1a692268f916b1a9131cd4b7",
  "tree": "7d70e6b76f0e504852b11f11c09682b49960f358",
  "parents": [
    "4764049dd620affcd3e2658dc7f03a6616370a29"
  ],
  "author": {
    "name": "Jakub Jelinek",
    "email": "jakub@redhat.com",
    "time": "Fri Oct 15 16:28:34 2021 +0200"
  },
  "committer": {
    "name": "Jakub Jelinek",
    "email": "jakub@redhat.com",
    "time": "Fri Oct 15 16:28:34 2021 +0200"
  },
  "message": "openmp: Fix up strtoul and strtoull uses in libgomp\n\nYesterday when working on numa_domains, I\u0027ve noticed because of a bug\nin my patch a hang on a large NUMA machine.  I\u0027ve fixed the bug, but\nalso discovered that the hang was a result of making wrong assumptions\nabout strtoul/strtoull.  All the uses were for portability setting\nerrno \u003d 0 before the calls and treating non-zero errno after the call\nas invalid input, but for the case where there are no valid digits at\nall strtoul may set errno to EINVAL, but doesn\u0027t have to and with\nglibc doesn\u0027t do that.  So, this patch goes through all the strtoul calls\nand next to errno !\u003d 0 checks adds also endptr \u003d\u003d startptr check.\nHaven\u0027t done it in places where we immediately reject strtoul returning 0\nthe same as we reject errno !\u003d 0, because strtoul must return 0 in the\ncase where it sets endptr to the start pointer.  In some spots the code\nwas using errno \u003d 0; x \u003d strtoul (p, \u0026p, 10); if (errno) { /*invalid*/ }\nand those spots had to be changed to\nerrno \u003d 0; x \u003d strtoul (p, \u0026end, 10); if (errno || end \u003d\u003d p) { /*invalid*/ }\np \u003d end;\n\n2021-10-15  Jakub Jelinek  \u003cjakub@redhat.com\u003e\n\n\t* env.c (parse_schedule): For strtoul or strtoull calls which don\u0027t\n\tclearly reject return value 0 as invalid handle the case where end\n\tpointer is the same as first argument as invalid.\n\t(parse_unsigned_long_1): Likewise.\n\t(parse_one_place): Likewise.\n\t(parse_places_var): Likewise.\n\t(parse_stacksize): Likewise.\n\t(parse_spincount): Likewise.\n\t(parse_affinity): Likewise.\n\t(parse_gomp_openacc_dim): Likewise.  Avoid strict aliasing violation.\n\tMake code valid C89.\n\t* config/linux/affinity.c (gomp_affinity_find_last_cache_level):\n\tFor strtoul calls which don\u0027t clearly reject return value 0 as\n\tinvalid handle the case where end pointer is the same as first\n\targument as invalid.\n\t(gomp_affinity_init_level_1): Likewise.\n\t(gomp_affinity_init_numa_domains): Likewise.\n\t* config/rtems/proc.c (parse_thread_pools): Likewise.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "69e72a8d1413e0cdacc0191440e4f95087c05caf",
      "old_mode": 33188,
      "old_path": "libgomp/config/linux/affinity.c",
      "new_id": "e11906abec4a7f561fe57b90d6169e7bce6b1b76",
      "new_mode": 33188,
      "new_path": "libgomp/config/linux/affinity.c"
    },
    {
      "type": "modify",
      "old_id": "97b9e2faa879274aa5496e4a0b3410feb251267e",
      "old_mode": 33188,
      "old_path": "libgomp/config/rtems/proc.c",
      "new_id": "ad40de4c3811e1bb149a226e8039f5811ffc4b56",
      "new_mode": 33188,
      "new_path": "libgomp/config/rtems/proc.c"
    },
    {
      "type": "modify",
      "old_id": "7eb895f6b6948dd2db53ebbf969e4d17233c98e7",
      "old_mode": 33188,
      "old_path": "libgomp/env.c",
      "new_id": "b0acacb57838e3efaa4a897a6a710faad3334433",
      "new_mode": 33188,
      "new_path": "libgomp/env.c"
    }
  ]
}
