Uploaded image for project: 'Couchbase PHP client library'
  1. Couchbase PHP client library
  2. PCBC-37

Segfault when invalid hostname is provided on connection.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 1.0
    • 1.0
    • None
    • Security Level: Public
    • None

    Description

      <?php

      $cb = new Couchbase("http://127.0.0.1:8091", ...); // the correct host should be just 127.0.0.1:8091

      will result in a Segfault with the following backtrace:

      #0 php_couchbase_error_callback (handle=0x7f861c056600, error=LIBCOUCHBASE_UNKNOWN_HOST, errinfo=0x7fff6de008d8 "Failed to look up \"http://127.0.0.1:8091\"") at couchbase.c:828
      828 if (ctx->res->seqno < 0) {
      (gdb) bt
      #0 php_couchbase_error_callback (handle=0x7f861c056600, error=LIBCOUCHBASE_UNKNOWN_HOST, errinfo=0x7fff6de008d8 "Failed to look up \"http://127.0.0.1:8091\"") at couchbase.c:828
      #1 0x000000010eefac1d in libcouchbase_error_handler ()
      #2 0x000000010eefdbc8 in libcouchbase_connect ()
      #3 0x000000010eeef1d5 in php_couchbase_create_impl () at couchbase.c:982
      #4 0x000000010e5a5480 in zend_do_fcall_common_helper_SPEC ()
      #5 0x000000010e5a5b5d in execute ()
      #6 0x000000010e5416d9 in zend_execute_scripts ()
      #7 0x000000010e4f203e in php_execute_script ()
      #8 0x000000010e5bbcd8 in main ()

      To resolve this we should:

      a) not segfault but return a proper error
      b) check if there is a http:// prefix in the supplied hostname, for convenience.

      Attachments

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

        Activity

          People

            laruence Xinchen Hui
            jan Jan Lehnardt (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty