Module: wine Branch: master Commit: 2705e6c319119663836e3c3c7a18649b0afad028 URL: https://gitlab.winehq.org/wine/wine/-/commit/2705e6c319119663836e3c3c7a18649...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Jun 13 10:47:20 2023 +0200
server: Also enforce the size of varargs data structures.
---
include/wine/server_protocol.h | 3 ++- server/protocol.def | 1 + server/request.h | 18 ++++++++++++++++++ tools/make_requests | 22 +++++++++++++++++++++- 4 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 5a14a3c4370..1dfb9131f50 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -456,6 +456,7 @@ typedef union { enum select_op op; obj_handle_t handles[MAXIMUM_WAIT_OBJECTS]; + int __pad; } wait; struct { @@ -6413,7 +6414,7 @@ union generic_reply
/* ### protocol_version begin ### */
-#define SERVER_PROTOCOL_VERSION 774 +#define SERVER_PROTOCOL_VERSION 775
/* ### protocol_version end ### */
diff --git a/server/protocol.def b/server/protocol.def index 4237737ab40..90227fad66a 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -472,6 +472,7 @@ typedef union { enum select_op op; /* SELECT_WAIT or SELECT_WAIT_ALL */ obj_handle_t handles[MAXIMUM_WAIT_OBJECTS]; + int __pad; } wait; struct { diff --git a/server/request.h b/server/request.h index ea08babdda8..f1ec5c63579 100644 --- a/server/request.h +++ b/server/request.h @@ -689,13 +689,17 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
C_ASSERT( sizeof(abstime_t) == 8 ); C_ASSERT( sizeof(affinity_t) == 8 ); +C_ASSERT( sizeof(apc_call_t) == 48 ); C_ASSERT( sizeof(apc_param_t) == 8 ); C_ASSERT( sizeof(apc_result_t) == 40 ); C_ASSERT( sizeof(async_data_t) == 40 ); C_ASSERT( sizeof(atom_t) == 4 ); C_ASSERT( sizeof(char) == 1 ); C_ASSERT( sizeof(client_ptr_t) == 8 ); +C_ASSERT( sizeof(context_t) == 1720 ); +C_ASSERT( sizeof(cursor_pos_t) == 24 ); C_ASSERT( sizeof(data_size_t) == 4 ); +C_ASSERT( sizeof(debug_event_t) == 160 ); C_ASSERT( sizeof(file_pos_t) == 8 ); C_ASSERT( sizeof(generic_map_t) == 16 ); C_ASSERT( sizeof(hw_input_t) == 40 ); @@ -704,17 +708,31 @@ C_ASSERT( sizeof(ioctl_code_t) == 4 ); C_ASSERT( sizeof(irp_params_t) == 32 ); C_ASSERT( sizeof(lparam_t) == 8 ); C_ASSERT( sizeof(mem_size_t) == 8 ); +C_ASSERT( sizeof(message_data_t) == 56 ); C_ASSERT( sizeof(mod_handle_t) == 8 ); C_ASSERT( sizeof(obj_handle_t) == 4 ); +C_ASSERT( sizeof(pe_image_info_t) == 80 ); C_ASSERT( sizeof(process_id_t) == 4 ); +C_ASSERT( sizeof(property_data_t) == 16 ); C_ASSERT( sizeof(rectangle_t) == 16 ); +C_ASSERT( sizeof(select_op_t) == 264 ); C_ASSERT( sizeof(short int) == 2 ); +C_ASSERT( sizeof(startup_info_t) == 92 ); +C_ASSERT( sizeof(struct filesystem_event) == 12 ); +C_ASSERT( sizeof(struct handle_info) == 20 ); C_ASSERT( sizeof(struct luid) == 8 ); +C_ASSERT( sizeof(struct luid_attr) == 12 ); +C_ASSERT( sizeof(struct object_attributes) == 16 ); +C_ASSERT( sizeof(struct object_type_info) == 44 ); +C_ASSERT( sizeof(struct process_info) == 40 ); +C_ASSERT( sizeof(struct rawinput_device) == 12 ); +C_ASSERT( sizeof(struct thread_info) == 40 ); C_ASSERT( sizeof(thread_id_t) == 4 ); C_ASSERT( sizeof(timeout_t) == 8 ); C_ASSERT( sizeof(unsigned char) == 1 ); C_ASSERT( sizeof(unsigned int) == 4 ); C_ASSERT( sizeof(unsigned short) == 2 ); +C_ASSERT( sizeof(user_apc_t) == 40 ); C_ASSERT( sizeof(user_handle_t) == 4 ); C_ASSERT( FIELD_OFFSET(struct new_process_request, token) == 12 ); C_ASSERT( FIELD_OFFSET(struct new_process_request, debug) == 16 ); diff --git a/tools/make_requests b/tools/make_requests index e5db1c7fc0a..a3c987c4702 100755 --- a/tools/make_requests +++ b/tools/make_requests @@ -52,6 +52,25 @@ my %formats = "generic_map_t" => [ 16, 4, "&dump_generic_map" ], "ioctl_code_t" => [ 4, 4, "&dump_ioctl_code" ], "hw_input_t" => [ 40, 8, "&dump_hw_input" ], + # varargs-only structures + "apc_call_t" => [ 48, 8 ], + "context_t" => [ 1720, 8 ], + "cursor_pos_t" => [ 24, 8 ], + "debug_event_t" => [ 160, 8 ], + "message_data_t" => [ 56, 8 ], + "pe_image_info_t" => [ 80, 8 ], + "property_data_t" => [ 16, 8 ], + "select_op_t" => [ 264, 8 ], + "startup_info_t" => [ 92, 4 ], + "user_apc_t" => [ 40, 8 ], + "struct filesystem_event" => [ 12, 4 ], + "struct handle_info" => [ 20, 4 ], + "struct luid_attr" => [ 12, 4 ], + "struct object_attributes" => [ 16, 4 ], + "struct object_type_info" => [ 44, 4 ], + "struct process_info" => [ 40, 8 ], + "struct rawinput_device" => [ 12, 4 ], + "struct thread_info" => [ 40, 8 ], );
my @requests = (); @@ -479,7 +498,8 @@ push @request_lines, "};\n\n";
foreach my $type (sort keys %formats) { - my $size = ${$formats{$type}}[0]; + my ($size, $align) = @{$formats{$type}}; + die "$type: invalid size $size for alignment $align" if $size % $align; push @request_lines, "C_ASSERT( sizeof($type) == $size );\n"; } push @request_lines, @asserts;