Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
touisteur opened this issue Dec 9, 2017 · 0 comments

Comments

@touisteur
Copy link

touisteur commented Dec 9, 2017

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant