Description
I have a scenario where I need to create an empty binary array. I do this by using the following API:
axutil_base64_binary_t* binary = axutil_base64_binary_create(env);
The problem that I have is that when I pass this variable to one of my types and then serialize the call to send it out, I get an "Invalid allocation .." exception saying that the allocation size was requested which exceeds the limit of 2GB. I was able to track down the issue to the empty binary. The problem, as the title of this bug indicates, is that the length of the binary is not initialized to zero. Therefore, the error occurs in the API : axutil_base64_binary_get_encoded_binary where a malloc is done which is dependent on the size/length of the binary. Since the length variable is an arbitrary value, I can get the problem outlined before.
I was able to get around the problem by initializing the binary instead as follows (clearly a workaround):
usigned char t[1];
axutil_base64_binary_t* binary = axutil_base64_binary_create_with_plain_binary(env, t, 0);
Frank