Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences
C++ algoliadatastoreelasticsearchenterprise-searchfacetingfull-text-searchfuzzy-searchgeosearchin-memoryinstantsearchmerchandisingpineconesearchsearch-enginesemantic-searchsimilarity-searchsite-searchsynonymstypo-tolerancevector-search
Fix strange random memory error.
Kishore Nallan9f5b6ed8de08
diff --git a/src/http_server.cpp b/src/http_server.cppindex cd97131c..9b4d5f09 100644--- a/src/http_server.cpp+++ b/src/http_server.cpp@@ -395,9 +395,12 @@ int HttpServer::catch_all_handler(h2o_handler_t *_h2o_handler, h2o_req_t *req) {// Extract auth key from header. If that does not exist, look for a GET parameter.ssize_t auth_header_cursor = h2o_find_header_by_str(&req->headers, http_req::AUTH_HEADER, strlen(http_req::AUTH_HEADER), -1);+if(auth_header_cursor != -1) {h2o_iovec_t & slot = req->headers.entries[auth_header_cursor].value;- h2o_handler->api_auth_key_sent = std::string(slot.base, slot.len);+ const std::string api_auth_key_sent = std::string(slot.base, slot.len);+ // NOTE: directly using `h2o_handler->api_auth_key_sent` without an intermediate string causes memory errors+ h2o_handler->api_auth_key_sent = api_auth_key_sent;} else if(query_map.count(http_req::AUTH_HEADER) != 0) {h2o_handler->api_auth_key_sent = query_map[http_req::AUTH_HEADER];}