[dawn][wire] Make the server validate invalid null string views.

Since we have both NullableStringView and StringView types, any
entry point that takes StringView should reject the call when
passed a null string.

This fixes the fuzz tests that are hitting this path when trying
to convert the null WGPUStringViews into string_views and hits
an assert.

Bug: 355484325 355533783
Change-Id: I8db838c74c23c56417d2b600f58fa39f4af6c58f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/200177
Auto-Submit: Loko Kung <lokokung@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
diff --git a/generator/templates/dawn/wire/server/ServerDoers.cpp b/generator/templates/dawn/wire/server/ServerDoers.cpp
index d03dbbd..43957e7 100644
--- a/generator/templates/dawn/wire/server/ServerDoers.cpp
+++ b/generator/templates/dawn/wire/server/ServerDoers.cpp
@@ -52,6 +52,17 @@
                         {%- if not loop.last -%}, {% endif %}
                     {%- endfor -%}
                 ) {
+                    //* Some arguments need to be sanitized so do that now.
+                    {% for member in command.members %}
+                        {% set MemberName = as_varName(member.name) %}
+                        {% if member.type.name.get() == "string view" %}
+                            // String views must not be nullable.
+                            if ({{MemberName}}.data == nullptr && {{MemberName}}.length == SIZE_MAX) {
+                                return WireResult::FatalError;
+                            }
+                        {% endif %}
+                    {% endfor %}
+
                     {% set ret = command.members|selectattr("is_return_value")|list %}
                     //* If there is a return value, assign it.
                     {% if ret|length == 1 %}