dawn-cmake/generator/templates/dawn_wire
Corentin Wallez 75f554d973 WireCmd: disallow optional members with length="otherMember"
This didn't make sense since these members can be specified to have no
data by setting the length to 0.

 - Prevent uses of this patten by adding an assert in WireCmd.cpp's
   generator.
 - Fix SetBindGroup dynamicOffset to not be optional but default to
   nullptr instead.

This issues would cause a read of uninitialized pointers becaus the
generator code looked like this:

  SetBindGroupCmd cmd;
  cmd.dynamicOffsetCount = record.dynamicOffsetCount; // 1
  bool has_dynamicOffset = record.has_dynamicOffsetl // false
  if (has_dynamicOffset) {
    cmd.dynamicOffsets = ...;
  }
  // Oh no! dynamicOffsets contains garbage even if dynamicOffsetCount
  // is set to 1. dawn_native will happily read it.

Bug: chromium:1220036
Change-Id: I5c468b639f671cef3be2fa64667a0bf114fc902b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/54643
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2021-06-17 16:04:29 +00:00
..
client dawn_wire: Move BufferConsumer to it's own file. Unify WIRE_TRY 2021-02-25 20:21:25 +00:00
server dawn_wire: Move BufferConsumer to it's own file. Unify WIRE_TRY 2021-02-25 20:21:25 +00:00
ObjectType.h Track and destroy all child objects on wire client destruction 2020-11-11 19:46:18 +00:00
WireCmd.cpp WireCmd: disallow optional members with length="otherMember" 2021-06-17 16:04:29 +00:00
WireCmd.h dawn_wire: Move BufferConsumer to it's own file. Unify WIRE_TRY 2021-02-25 20:21:25 +00:00