Skip to content
This repository was archived by the owner on Mar 5, 2026. It is now read-only.
This repository was archived by the owner on Mar 5, 2026. It is now read-only.

Stream_Error with test cases 8G76 and 98YD (and fuzzing results) and simple test program #9

@touisteur

Description

@touisteur

Hi, running the following simple example program, causes a crash with YAML.STREAM_ERROR exception.

with Utils;
with Ada.Text_IO;
with Ada.Command_Line;
with GNAT.Exception_Actions;
with Ada.Exceptions;
with Yaml.Dom;
with Yaml.Dom.Vectors;
with Yaml.Dom.Loading;
with Yaml.Dom.Dumping;
with Yaml.Events.Queue;
procedure Yaml_Test
is
  S : constant String := Utils.File_Content (Ada.Command_Line.Argument (1));
begin
  Ada.Text_IO.Put_Line (S);
  declare
     V : constant Yaml.Dom.Vectors.Vector := Yaml.Dom.Loading.From_String (S);
     E : constant Yaml.Events.Queue.Reference :=
       Yaml.Dom.Dumping.To_Event_Queue (V);
     pragma Unreferenced (E);
  begin
     null;
  end;
exception
  when Occurence : others =>
     Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Information (Occurence));
     GNAT.Exception_Actions.Core_Dump (Occurence);
end Yaml_Test;

I cite one of your e-mails:

This error means that a malformed event stream has been encountered. Parsing a YAML input stream or serializing a DOM structure should always create a valid event stream unless it raises an exception – hence getting Yaml.Stream_Error would actually show that there's an internal error in one of those components.

Yaml.Stream_Error would only be an error with external cause if you generate an event stream manually in your code.

See also stream-error-crashes.zip.

I get the following:

  • raised YAML.STREAM_ERROR : Unexpected event (expected document end): ALIAS​​
  • raised YAML.STREAM_ERROR : Unexpected event (expected document end): MAPPING_START​
  • raised YAML.STREAM_ERROR : Unexpected event (expected document end): SCALAR​
  • raised YAML.STREAM_ERROR : Unexpected event (expected document end): SEQUENCE_START​
  • raised YAML.STREAM_ERROR : Unexpected event (expected document start): STREAM_END

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions