Menu

#10 Bug in ExtCompReader - wrong datatype of variable startOffset (int/long)

v1.0 (example)
closed
nobody
Bug (1)
5
2023-05-25
2023-05-25
No

Hey together,
today i found a bug in the ExtCompReader.java -> readNumberValues(...) function, regarding the datatype of startOffset variable (line 233), currently the java datatype is int, i'm pretty sure it should be long.
In the readStringValues(...) function you use already long for startOffset.

This leeds to errors with external files greater than ~2GB.

If you need more information or something, please give a me feedback.

Kind regards
Michael Stoll

Discussion

  • Markus Renner

    Markus Renner - 2023-05-25

    Hello Mr. Stoll,

    thank you for this report! I will look into it and let you know, whether this is really a bug or dependent on the ODS version. The datatype for the startOffset was changed from int to long in the past, so it may be that we missed to adjust this in this case or it depends on the correct ODS version. Please send me the base model version you are using in this context so I can better check. Thank you!

    Best regards,
    Markus

     
    • Michael Stoll

      Michael Stoll - 2023-05-25

      Hey Markus,
      the change of the datatype of start_offset from DT_LONG(A_INT32) to DT_LONG_LONG(INT_64) was from base version 29 -> 30. The library reads it correct, but the value is then stored in a java int (same as INT32), but this cuts off values for DT_LONG_LONG.

      Relevant code from lib (ExtCompReader.java -> from line 232):

      // read start offset, may be DT_LONG or DT_LONGLONG
      int startOffset = 0; // -> Maximum number 2147483647 
      attrNo = atfxCache.getAttrNoByBaName(aidExtComp, "start_offset");
       TS_Value vStartOffset = atfxCache.getInstanceValue(aidExtComp, attrNo, iidExtComp);
      if (vStartOffset.u.discriminator() == DataType.DT_LONG) {
           startOffset = vStartOffset.u.longVal();
      } else if (vStartOffset.u.discriminator() == DataType.DT_LONGLONG) {
           startOffset = (int) ODSHelper.asJLong(vStartOffset.u.longlongVal()); // -> long value gets mapped to int -> numbers higher 2147483647 resulting in an error
      }
      

      We created lib by our own and changed to (like in readStringValues-function) :

      // read start offset, may be DT_LONG or DT_LONGLONG 
      long startOffset = 0;
      attrNo = atfxCache.getAttrNoByBaName(aidExtComp, "start_offset");
       TS_Value vStartOffset = atfxCache.getInstanceValue(aidExtComp, attrNo, iidExtComp);
      if (vStartOffset.u.discriminator() == DataType.DT_LONG) {
           startOffset = vStartOffset.u.longVal();
      } else if (vStartOffset.u.discriminator() == DataType.DT_LONGLONG) {
           startOffset = ODSHelper.asJLong(vStartOffset.u.longlongVal()); 
      }
      

      This was working for us ;)

      Kind regards
      Michael

       
  • Markus Renner

    Markus Renner - 2023-05-25

    Hi Michael,

    ok, that seems to be a bug indeed. I will integrate your solution in the next fix version. Thank you very much for this helpful input!

    Best regards,
    Markus

     
  • Markus Renner

    Markus Renner - 2023-05-25

    The bug is fixed now in version 1.3.3, thank you again for reporting it!

     
  • Markus Renner

    Markus Renner - 2023-05-25
    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB