-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lydict_val_eq using cb_data as strncmp's len, is it right in some conditions ? #1045
Comments
Hi, Regards, |
Hi,
+@@ -202,7 +212,8 @@ dict_insert(struct ly_ctx *ctx, char *value, size_t len, int zerocopy) | 49 | + /* create record for lyht_insert */ +@@ -32,13 +32,22 @@ lydict_val_eq(void *val1_p, void *val2_p, int UNUSED(mod), void *cb_data) | 17 | + +@@ -160,6 +169,7 @@ lydict_remove(struct ly_ctx *ctx, const char *value) | 41 | + /* create record for lyht_find call */ |
Hi, Regards, |
Hi, |
... because we are again comparing a possibly unterminated string. Refs #1045
Hi, Regards, |
Hi version: 1.0.130 The same prolbem happened,
Some personal informations are hide. |
Hi, Regards, |
... because we are again comparing a possibly unterminated string. Refs #1045
Hi,
I have a problem in libyang, it occurs in func lyht_resize, assert(!ret); I analysis and find error in func: lyht_insert_with_resize_cb, line: ht->val_equal(val_p, &rec->val, 1, ht->cb_data), it is func: lydict_val_eq, *(size_t *)cb_data is 5, str1 is "Service58844", str2 is "Service13604", so it return 1。
It occurs when dict_insert (ctx=0xb696c0, value=0x7fff7f0bff40 "96507", len=5, zerocopy=1), in fact , the data to be inserted is "96507", and its len is 5. but when it is inserted , hash need to be resize. And during resize , data whose value is "Service58844" and data whose value is "Service13604" conflict. But "Service58844", len is 11, not 5. So if it is not right when strncmp in func:lydict_val_eq using len 5。
The backtrace is :
lyht_insert_with_resize_cb
lyht_insert
lyht_resize
lyht_insert_with_resize_cb
lyht_insert
dict_insert (ctx=0xb696c0, value=0x7fff7f0bff40 "96507", len=5, zerocopy=1)
Thanks very much !
The text was updated successfully, but these errors were encountered: