Uploaded image for project: 'OpenFAST'
  1. OpenFAST
  2. FAST-64

NegativeArraySizeException while decoding ProductSnapshot

    Details

    • Type: Bug
    • Status: Open
    • Priority: Default
    • Resolution: Unresolved
    • Affects Version/s: 1.1.2
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      Java 1.7/1.8 Eurex Sim T7 4.0

      Description

      Hi, OpenFAST team.

      While decoding new version of reference data from Eurex T7 4.0 with RDDFastTemplates-1.1.xml (http://www.eurexchange.com/blob/2732742/809e0a1d9dc6cb9dae4126affe1c9395/data/Eurex-Market---Reference-Data-Interfaces---XML-FAST-Templates---FIXML-schema-files.zip) with openfast-1.1.2 I have found some decoding errors including NegativeArraySizeException. Using following small test I could reproduce it.

      public static void main(String[] args) throws IOException {
          MessageTemplateLoader templateLoader = new XMLMessageTemplateLoader();
          
          List<MessageTemplate> templates = new ArrayList<>();
          MessageTemplate[] hardcodedTemplates = templateLoader.load(new ByteArrayInputStream("<template id=\"120\" name=\"FastReset\"></template>".getBytes()));
          templates.addAll(Arrays.asList(hardcodedTemplates));
          try (InputStream templateSource = Main.class.getClassLoader().getResourceAsStream("RDDFastTemplates-1.1.xml")) { 
              templates.addAll(Arrays.asList(templateLoader.load(templateSource)));
          }
          
          try (InputStream fastEncodedStream = Main.class.getClassLoader().getResourceAsStream("fastdata.bin")) {
              MessageInputStream messageIn = new MessageInputStream(fastEncodedStream);
              messageIn.getContext().setTraceEnabled(true);
              for (MessageTemplate mt : templates) {
                  messageIn.registerTemplate(Integer.valueOf(mt.getId()), mt);
              }
              Message message = null;
              do {
                  message = messageIn.readMessage();
                  System.out.println(message);
              } while (message != null);
          }
      }
      
      Exception in thread "main" java.lang.NegativeArraySizeException
      	at org.openfast.ByteUtil.combine(ByteUtil.java:125)
      	at org.openfast.util.Util.applyDifference(Util.java:82)
      	at org.openfast.template.operator.DeltaStringOperatorCodec.decodeValue(DeltaStringOperatorCodec.java:77)
      	at org.openfast.template.Scalar.decodeValue(Scalar.java:174)
      	at org.openfast.template.Scalar.decode(Scalar.java:234)
      	at org.openfast.template.Group.decodeFieldValues(Group.java:293)
      	at org.openfast.template.Group.decodeFieldValues(Group.java:256)
      	at org.openfast.template.Group.decode(Group.java:223)
      	at org.openfast.template.Sequence.decode(Sequence.java:206)
      	at org.openfast.template.Group.decodeFieldValues(Group.java:293)
      	at org.openfast.template.MessageTemplate.decode(MessageTemplate.java:126)
      	at org.openfast.codec.FastDecoder.readMessage(FastDecoder.java:95)
      	at org.openfast.MessageInputStream.readMessage(MessageInputStream.java:70)
      	at local.Main.main(Main.java:38)
      

      Could you please have a look.

        Attachments

          Activity

            People

            • Assignee:
              jacob_northey Jacob Northey
              Reporter:
              Alexander Piskarev Alexander Piskarev
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: