Commit 6024620
authored
Fix Windows registry name crashes (netdata#20097)
* Fix Windows registry name crashes and optimize memory with Judy arrays
This commit addresses two key issues with Windows performance counter registry handling:
1. Fixes crashes due to improper registry data parsing:
- Added comprehensive validation of registry data structure
- Added bounds checking to prevent buffer overruns
- Added validation of ID string conversion
- Improved error logging for malformed registry entries
2. Optimizes memory usage with Judy arrays:
- Replaced fixed-size array with memory-efficient Judy array
- Memory usage now scales with actual data rather than highest ID
- Eliminated arbitrary limit on registry ID values
- Added proper resource cleanup on shutdown
Added unit tests to verify functionality and demonstrate memory efficiency
with sparseness statistics. Run with: -W perflibnamestest
* Enhance Windows registry validation and add comprehensive tests1 parent 7ce3f10 commit 6024620
5 files changed
Lines changed: 656 additions & 43 deletions
File tree
- src
- collectors/windows.plugin
- daemon
- libnetdata/os/windows-perflib
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
125 | 128 | | |
126 | 129 | | |
127 | 130 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
404 | 404 | | |
405 | 405 | | |
406 | 406 | | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
407 | 410 | | |
408 | 411 | | |
409 | 412 | | |
| |||
455 | 458 | | |
456 | 459 | | |
457 | 460 | | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
458 | 465 | | |
459 | 466 | | |
460 | 467 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
26 | 30 | | |
0 commit comments