Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-10043

function qt_wince_bsearch() throws an exception (Access violation) if doesn't find a key value

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.6.3
    • 4.6.2
    • None
    • None
    • 2cc7a785eff228f414faa09ff882c2f0a2092cfd

    Description

      corelib\kernel\qfunctions_wince.cpp

      see my comment below:

      void *qt_wince_bsearch(const void *key,
                 const void *base,
                 size_t num,
                 size_t size,
                 int (__cdecl *compare)(const void *, const void *))
      {
          size_t low = 0;
          size_t high = num - 1;
          while (low <= high) {
              unsigned int mid = ((unsigned) (low + high)) >> 1;
              int c = compare(key, (char*)base + mid * size);
              if (c < 0)
                  high = mid - 1; // <-- high is an unsigned value, so if mid == 0 then high == 0xffffffff , and condition low <= high is not satisfied 
              else if (c > 0)
                  low = mid + 1;
              else
                  return (char*) base + mid * size;
          }
          return (NULL);
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jbornema Joerg Bornemann
            coldfire Alexei Soloviev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes