This repository has been archived by the owner on Feb 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 122
cpp: malformed key names not rejected #2583
Labels
Comments
I've modified the title as this is no python nor swig issue. A possible fix, feel free to commit this: --- a/src/bindings/cpp/include/key.hpp
+++ b/src/bindings/cpp/include/key.hpp
@@ -604,6 +604,7 @@ inline Key::Key (const char * keyName, ...)
va_end (ap);
if (!key) throw std::bad_alloc ();
+ if (ckdb::keyGetUnescapedNameSize (key) <= 0) throw KeyInvalidName ();
operator++ ();
}
@@ -628,6 +629,7 @@ inline Key::Key (const std::string keyName, ...)
va_end (ap);
if (!key) throw std::bad_alloc ();
+ if (ckdb::keyGetUnescapedNameSize (key) <= 0) throw KeyInvalidName ();
operator++ ();
}
@@ -645,6 +647,7 @@ inline Key::Key (const char * keyName, va_list ap)
key = ckdb::keyVNew (keyName, ap);
if (!key) throw std::bad_alloc ();
+ if (ckdb::keyGetUnescapedNameSize (key) <= 0) throw KeyInvalidName ();
operator++ ();
} |
Thank you! Can you please add this commit to your PR? |
Merged
@markus2330 As expected changing the ctor to throw on invalid names makes tests fail on other places. Can you or someone else please take over ea8a01e. I feel like I've already invested enough time in this. |
Actually this problem will solve itself once #3115 is merged. Because then keyNew will fail with malformed key names. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Steps to Reproduce the Problem
Expected Result
That for both ways to assign the key's name an exception is raised that "abc" is not a valid keyname.
Actual Result
System Information
The text was updated successfully, but these errors were encountered: