Avoid UB for deep nested processes

Also increase the limit for nesting by using 64 bit integers.

ProcessList.c:242:36: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
    #0 0x561cfec000a8 in ProcessList_buildTreeBranch ProcessList.c:242:36
    #1 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #2 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #3 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #4 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #5 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #6 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #7 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #8 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #9 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #10 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #11 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #12 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #13 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #14 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #15 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #16 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #17 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #18 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #19 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #20 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #21 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #22 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #23 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #24 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #25 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #26 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #27 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #28 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #29 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #30 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #31 0x561cfebffec2 in ProcessList_buildTreeBranch ProcessList.c:243:7
    #32 0x561cfebfb734 in ProcessList_buildTree ProcessList.c:312:10
    #33 0x561cfebfb050 in ProcessList_updateDisplayList ProcessList.c:326:10
    #34 0x561cfebfc58b in ProcessList_rebuildPanel ProcessList.c:374:4
    #35 0x561cfec07953 in checkRecalculation ScreenManager.c:139:7
    #36 0x561cfec07953 in ScreenManager_run ScreenManager.c:226:10
    #37 0x561cfeb8899a in CommandLine_run CommandLine.c:378:4
    #38 0x561cfeb6d6d4 in main htop.c:15:11
    #39 0x7f14860291e9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #40 0x7f148602929b in __libc_start_main csu/../csu/libc-start.c:392:3
    #41 0x561cfeaafb20 in _start (htop+0x105b20) (BuildId: fc4b9e52ffc111ca8b4cd53136a238414120a858)
3 files changed
tree: bb941cdca94216f04a78c95a0124bfa82d65fea8
  1. .github/
  2. darwin/
  3. docs/
  4. dragonflybsd/
  5. freebsd/
  6. generic/
  7. iwyu/
  8. linux/
  9. netbsd/
  10. openbsd/
  11. pcp/
  12. scripts/
  13. solaris/
  14. unsupported/
  15. zfs/
  16. .editorconfig
  17. .gitignore
  18. .travis.yml
  19. Action.c
  20. Action.h
  21. Affinity.c
  22. Affinity.h
  23. AffinityPanel.c
  24. AffinityPanel.h
  25. AUTHORS
  26. autogen.sh
  27. AvailableColumnsPanel.c
  28. AvailableColumnsPanel.h
  29. AvailableMetersPanel.c
  30. AvailableMetersPanel.h
  31. BatteryMeter.c
  32. BatteryMeter.h
  33. CategoriesPanel.c
  34. CategoriesPanel.h
  35. ChangeLog
  36. ClockMeter.c
  37. ClockMeter.h
  38. ColorsPanel.c
  39. ColorsPanel.h
  40. ColumnsPanel.c
  41. ColumnsPanel.h
  42. CommandLine.c
  43. CommandLine.h
  44. CommandScreen.c
  45. CommandScreen.h
  46. Compat.c
  47. Compat.h
  48. configure.ac
  49. CONTRIBUTING.md
  50. COPYING
  51. CPUMeter.c
  52. CPUMeter.h
  53. CRT.c
  54. CRT.h
  55. DateMeter.c
  56. DateMeter.h
  57. DateTimeMeter.c
  58. DateTimeMeter.h
  59. DiskIOMeter.c
  60. DiskIOMeter.h
  61. DisplayOptionsPanel.c
  62. DisplayOptionsPanel.h
  63. DynamicColumn.c
  64. DynamicColumn.h
  65. DynamicMeter.c
  66. DynamicMeter.h
  67. EnvScreen.c
  68. EnvScreen.h
  69. FunctionBar.c
  70. FunctionBar.h
  71. Hashtable.c
  72. Hashtable.h
  73. Header.c
  74. Header.h
  75. HeaderLayout.h
  76. HeaderOptionsPanel.c
  77. HeaderOptionsPanel.h
  78. HostnameMeter.c
  79. HostnameMeter.h
  80. htop.1.in
  81. htop.c
  82. htop.desktop
  83. htop.png
  84. htop.svg
  85. IncSet.c
  86. IncSet.h
  87. InfoScreen.c
  88. InfoScreen.h
  89. ListItem.c
  90. ListItem.h
  91. LoadAverageMeter.c
  92. LoadAverageMeter.h
  93. Macros.h
  94. MainPanel.c
  95. MainPanel.h
  96. Makefile.am
  97. MemoryMeter.c
  98. MemoryMeter.h
  99. MemorySwapMeter.c
  100. MemorySwapMeter.h
  101. Meter.c
  102. Meter.h
  103. MetersPanel.c
  104. MetersPanel.h
  105. NetworkIOMeter.c
  106. NetworkIOMeter.h
  107. NEWS
  108. Object.c
  109. Object.h
  110. OpenFilesScreen.c
  111. OpenFilesScreen.h
  112. OptionItem.c
  113. OptionItem.h
  114. Panel.c
  115. Panel.h
  116. pcp-htop.5.in
  117. pcp-htop.c
  118. Process.c
  119. Process.h
  120. ProcessList.c
  121. ProcessList.h
  122. ProcessLocksScreen.c
  123. ProcessLocksScreen.h
  124. ProvideCurses.h
  125. README
  126. RichString.c
  127. RichString.h
  128. ScreenManager.c
  129. ScreenManager.h
  130. ScreensPanel.c
  131. ScreensPanel.h
  132. Settings.c
  133. Settings.h
  134. SignalsPanel.c
  135. SignalsPanel.h
  136. SwapMeter.c
  137. SwapMeter.h
  138. SysArchMeter.c
  139. SysArchMeter.h
  140. TasksMeter.c
  141. TasksMeter.h
  142. test_spec.lua
  143. TESTPLAN
  144. TraceScreen.c
  145. TraceScreen.h
  146. UptimeMeter.c
  147. UptimeMeter.h
  148. UsersTable.c
  149. UsersTable.h
  150. Vector.c
  151. Vector.h
  152. XUtils.c
  153. XUtils.h