Commit 7ed8753
test: check that sysconf returns a positive value
Static analysis insists that sysconf(_SC_PAGE_SIZE) might return a
negative integer (even though it never will). This was supposed to be
handled by the existing check EXPECT_GE(page, static_cast<int>(N)).
I assume that static analysis does not consider this sufficient because
static_cast<int>(N) could be negative or zero if N exceeds INT_MAX (even
though it never will).
To resolve this (theoretical) problem, explicitly check that the return
value is positive and then cast it to a size_t.
PR-URL: #44666
Reviewed-By: Darshan Sen <raisinten@gmail.com>1 parent 2a37f74 commit 7ed8753Copy full SHA for 7ed8753
File tree
Expand file treeCollapse file tree
1 file changed
+22
-11
lines changedOpen diff view settings
Filter options
- test/cctest
Expand file treeCollapse file tree
1 file changed
+22
-11
lines changedOpen diff view settings
Collapse file
test/cctest/test_crypto_clienthello.cc
Copy file name to clipboardExpand all lines: test/cctest/test_crypto_clienthello.cc+22-11Lines changed: 22 additions & 11 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
29 | 29 | |
30 | 30 | |
31 | 31 | |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
32 | 46 | |
33 | 47 | |
34 | 48 | |
35 | 49 | |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
36 | 54 | |
37 | 55 | |
38 | 56 | |
39 | | - |
40 | | - |
41 | 57 | |
42 | 58 | |
43 | 59 | |
44 | 60 | |
45 | 61 | |
46 | 62 | |
47 | 63 | |
48 | | - |
49 | | - |
50 | | - |
51 | 64 | |
52 | 65 | |
53 | 66 | |
| ||
70 | 83 | |
71 | 84 | |
72 | 85 | |
| 86 | + |
| 87 | + |
| 88 | + |
73 | 89 | |
74 | | - |
75 | | - |
76 | | - |
77 | | - |
| 90 | + |
78 | 91 | |
79 | 92 | |
80 | 93 | |
81 | | - |
82 | | - |
83 | 94 | |
84 | 95 | |
85 | 96 | |
|
0 commit comments