- weakkey = (strchr(svalue(mode), 'k') != NULL);
- weakvalue = (strchr(svalue(mode), 'v') != NULL);
+ // Android's 'FORTIFY libc' calls __builtin_object_size on the argument of strchr.
+ // This produces an incorrect size for the expression `svalue(mode)`, causing
+ // an assertion. By placing it in a temporary, __builtin_object_size returns
+ // -1 (for unknown size) which functions correctly.
+ const char *tmp = svalue(mode);
+ weakkey = (strchr(tmp, 'k') != NULL);
+ weakvalue = (strchr(tmp, 'v') != NULL);