Uploaded image for project: 'Couchbase C client library libcouchbase'
  1. Couchbase C client library libcouchbase
  2. CCBC-1523

pillowfight: key prefix leads to exceptions

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Major
    • None
    • None
    • None
    • None
    • 1

    Description

      In current master, when using pillowfight setting an key prefix with -p leads to exceptions here:

      libcouchbase/tools/cbc-pillowfight.cc

      1130
      static void storeCallback(lcb_INSTANCE *instance, int, const lcb_RESPSTORE *resp)
      1131
      {
      1132
          InstanceCookie *cookie = InstanceCookie::get(instance);
      1133
          ThreadContext *tc = cookie->getContext();
      1134
          lcb_STATUS rc = lcb_respstore_status(resp);
      1135
          tc->setError(rc);
      1136
          updateStats(cookie, rc);
      1137
       
      1138
          const char *p;
      1139
          size_t n;
      1140
          lcb_respstore_key(resp, &p, &n);
      1141
          string key(p, n);
      1142
          uint32_t seqno = std::stol(key);
      

      Setting a non-numeric prefix e.g., "a" leads to:

      libc++abi: terminating with uncaught exception of type std::invalid_argument: stol: no conversion
      

      Setting a numeric, non-zero prefix (e.g., "1") leads to:

      libc++abi: terminating with uncaught exception of type std::out_of_range: stol: out of range
      

      It seems that the above snippet may need to strip the user-provided prefix before interpreting the key as a number.

      This appears to be a regression, but the last-good build/version hasn't been determined.

      Attachments

        Issue Links

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

          Activity

            People

              avsej Sergey Avseyev
              james.harrison James Harrison (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty