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

grib_io.c: restore signedness for arguments for seek

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Won't Fix
    • Icon: Medium Medium
    • ECC
    • None
    • i686

    • Other

      stdio.seek, which calls fseeko, uses "off_t" for argument, and
      when seeking toward head of the file, passing negative off_t value
      must be passed.

      Currently when callling stdio.seek, "size_t" variable is passed
      to the argument. On 64 bit system, the problem is hidden because
      both size_t (unsigned) and off_t (signed) are 64 bit.
      But on 32 bit system, as size_t is unsigned 32 bit and off_t is
      signed 64 bit, when passing size_t "message_size - already_read"
      (which is intended to be negative to seek toward head) is converted
      to large unsigned 32 bit value, which is not intended.

      The fix is to correctly cast to off_t.

      The attached patch fixes the following tests failure on 2.4.1:

      # 100 - eccodes_t_bufr_ecc-875
      # 118 - eccodes_t_gts_get
      # 119 - eccodes_t_gts_ls
      # 120 - eccodes_t_gts_count
      # 121 - eccodes_t_gts_compare
      # 122 - eccodes_t_metar_ls
      # 123 - eccodes_t_metar_get
      # 124 - eccodes_t_metar_dump
      # 125 - eccodes_t_metar_compare
      # 162 - eccodes_t_grib_copy
      

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

              Created:
              Updated:
              Resolved: