mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Compile-time check that control_event_t.event_mask is big enough
Add a compile-time check that the number of events doesn't exceed the capacity of control_event_t.event_mask.
This commit is contained in:
parent
99c10a95e4
commit
b41a5039f1
@ -1,4 +1,6 @@
|
|||||||
o Minor features (testing):
|
o Minor features (testing):
|
||||||
- Add unit tests for control_event_is_interesting().
|
- Add unit tests for control_event_is_interesting().
|
||||||
Part of ticket 15431, checks for bugs similar to 13085.
|
Add a compile-time check that the number of events doesn't exceed
|
||||||
|
the capacity of control_event_t.event_mask.
|
||||||
|
Closes ticket 15431, checks for bugs similar to 13085.
|
||||||
Patch by "teor".
|
Patch by "teor".
|
||||||
|
@ -166,6 +166,10 @@ void control_free_all(void);
|
|||||||
/* If EVENT_MAX_ ever hits 0x0040, we need to make the mask into a
|
/* If EVENT_MAX_ ever hits 0x0040, we need to make the mask into a
|
||||||
* different structure, as it can only handle a maximum left shift of 1<<63. */
|
* different structure, as it can only handle a maximum left shift of 1<<63. */
|
||||||
|
|
||||||
|
#if EVENT_MAX_ >= EVENT_CAPACITY_
|
||||||
|
#error control_connection_t.event_mask has an event greater than its capacity
|
||||||
|
#endif
|
||||||
|
|
||||||
#define EVENT_MASK_(e) (((uint64_t)1)<<(e))
|
#define EVENT_MASK_(e) (((uint64_t)1)<<(e))
|
||||||
|
|
||||||
#define EVENT_MASK_NONE_ ((uint64_t)0x0)
|
#define EVENT_MASK_NONE_ ((uint64_t)0x0)
|
||||||
|
Loading…
Reference in New Issue
Block a user