Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/dom/media/webrtc/tests/crashtests/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 2 kB image not shown  

Quelle  2014868.html

  Sprache: HTML
 

 products/Sources/formale Sprachen/C/Firefox/dom/media/webrtc/tests/crashtests/2014868.html


<!DOCTYPE html>
<html class="reftest-wait">
<head>
  <meta charset="utf-8">
  <title>Bug 2014868 - Reject SDP when MID changes at existing m-line index</title>
</head>
<body>
<script>
async function run() {
  try {
    const pc1 = new RTCPeerConnection();
    const pc2 = new RTCPeerConnection();

    pc1.addTransceiver("audio", { direction: "sendrecv" });
    pc1.addTransceiver("video", { direction: "recvonly" });
    pc1.createDataChannel("test");

    let offer = await pc1.createOffer();
    await pc1.setLocalDescription(offer);
    await pc2.setRemoteDescription(offer);
    let answer = await pc2.createAnswer();
    await pc2.setLocalDescription(answer);
    await pc1.setRemoteDescription(answer);

    // Stop video transceiver to trigger recycling logic
    for (const t of pc1.getTransceivers()) {
      if (t.receiver.track.kind === "video") {
        t.stop();
      }
    }

    offer = await pc1.createOffer();
    await pc1.setLocalDescription(offer);
    await pc2.setRemoteDescription(offer);
    answer = await pc2.createAnswer();
    await pc2.setLocalDescription(answer);
    await pc1.setRemoteDescription(answer);

    // Munge the offer: insert a duplicate video m-line at the application m-line
    // position. This displaces the application section and creates a media type
    // mismatch at that index, testing that we reject invalid type changes.
    const sdpLines = offer.sdp.split("\r\n");
    let mLineCount = 0;
    let insertIndex = -1;
    for (let i = 0i < sdpLines.length; i++) {
      if (sdpLines[i].startsWith("m=")) {
        mLineCount++;
        if (mLineCount === 2) {
          insertIndex = i;
        }
      }
    }

    // Duplicate the second m-line section with a changed MID
    if (insertIndex !== -1) {
      let endIndex = insertIndex + 1;
      for (let i = insertIndex + 1i < sdpLines.length; i++) {
        if (sdpLines[i].startsWith("m=")) {
          endIndex = i;
          break;
        }
      }
      if (endIndex === sdpLines.length) endIndex = sdpLines.length;

      const mlineSection = sdpLines.slice(insertIndex, endIndex);
      // Change the MID in the copied section
      for (let i = 0i < mlineSection.length; i++) {
        if (mlineSection[i].startsWith("a=mid:")) {
          mlineSection[i] = "a=mid:changed-mid";
          break;
        }
      }
      sdpLines.splice(endIndex, 0, ...mlineSection);
    }

    const modifiedAnswer = { type: "offer", sdp: sdpLines.join("\r\n") };
    await pc1.setRemoteDescription(modifiedAnswer);

    pc1.close();
    pc2.close();
  } catch (e) {
  }

  document.documentElement.removeAttribute("class");
}

run();
</script>
</body>
</html>

Messung V0.5 in Prozent
C=100 H=100 G=100

¤ Dauer der Verarbeitung: 0.15 Sekunden  (vorverarbeitet am  2026-08-25) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

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.