Uploaded image for project: 'Software Support'
  1. Software Support
  2. SUP-2408 some eccodes tests fail on i686 platform
  3. SUP-3559

decode_long_array: avoid overflow on 32 bit when overread

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Won't Fix
    • Icon: Medium Medium
    • ECC
    • Linux 32 bit

    • Other

      In grib_decode_unsigned_long and so on, when input argument nbits is 32
      (which should be supported on 32bit) and in the case
      "bitsToRead might now be negative (too many bits read)" happened,
      once the value "ret" can overflow 32 bit range, later with
      the operation "ret >>= -1 * bitsToRead;", "ret" gets fit in 32 bit value.

      So during the calculation of "ret" value, preserve the "ret" value
      which is to be carried up on left shift, and the last put back the
      carried up value to ret again on right shift.

      Note that even on 64 bit, currently when input argument nbit is 64 and
      when "too many bits read" happened, grib_decode_unsigned_long and so on
      don't behave correctly for now. This change will also fix this issue.

      The suggestion patch fixes the following failure on linux 32bit:

      #  65 - eccodes_t_bufr_dump_encode_filter
      #  67 - eccodes_t_bufrdc_ref
      #  76 - eccodes_t_bufr_filter_unpack_pack
      

            usv Daniel Varela Santoalla
            mtasaka@fedoraproject.org Mamoru TASAKA
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: