Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/dom/webgpu/crashtests/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 2 kB image not shown  

Quelle  1907222_truncate_error.html   Sprache: HTML

 
 products/Sources/formale Sprachen/C/Firefox/dom/webgpu/crashtests/1907222_truncate_error.html


<!DOCTYPE html>
<html class="reftest-wait">
  <head>
    <meta charset="utf-8" />
    <script src="/tests/SimpleTest/SimpleTest.js"></script>
    <link rel="stylesheet" href="/tests/SimpleTest/test.css" />
  </head>
  <body>
    <script>
      // Ensure that, when WebGPU generates an error message that is later
      // truncated by `wgpu_bindings::error::ErrorBuffer::init`, that
      // truncation always produces valid UTF-8, even when the error contains
      // multi-byte encodings.
      async function truncate_error_messages() {
        // The specific error we'll try to provoke is submitting a command
        // buffer to the wrong device's queue.
        const adapter = await navigator.gpu.requestAdapter();
        const device1 = await adapter.requestDevice();
        const device2 = await adapter.requestDevice();

        // Try a range of label lengths (578±200, where 578 is the length that
        // tickles the original bug), searching for one that, when combined with
        // the error message and then truncated at whatever error message byte
        // length limit Firefox is imposing, will produce invalid UTF-8.
        //
        // Use a label containing n space characters followed by a crab emoji,
        // U+1F980, which requires four bytes to encode in UTF-8. Since this has
        // a four-byte encoding at the end, we only need to try every third
        // length to ensure we will always try a truncation point in the midst
        // of that encoding.
        for (let len = 378; len < 778; len += 3) {
          const label = ' '.repeat(len) + '\uD83E\uDD80';
          const encoder = device1.createCommandEncoder({ label });
          const command_buffer = encoder.finish();

          // We don't want an error scope around this, because what makes
          // Firefox notice the bad UTF-8 is attempting to log the uncaught
          // WebGPU error as a warning.
          device2.queue.submit([command_buffer]);
        }
      }

      truncate_error_messages()
        .catch(e => {
          console.log(e);
        })
        .finally(() => {
          // End the crashtest.
          document.documentElement.removeAttribute("class");
        });
    </script>
  </body>
</html>

Messung V0.5
C=96 H=100 G=97

¤ Dauer der Verarbeitung: 0.12 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.