On Wed, Dec 21, 2011 at 10:41 AM, Jacob A. Camp
<jacob.c...@mastercam.com> wrote:
> I have a line of code that executes that line:
>
> const unsigned char * temp2 = sqlite3_column_text(state, 0);
>
> This queries the database and after the call is complete I pass this value to 
> another function. This function then fails because temp2 points to a location 
> that contains the incomplete text. I then can view this text using my 
> debugger and I can see that the value has been clipped and the XML is invalid.

Let me ask Igor's questions once again. How does your function
understand that text is incomplete? Your debugger can show you
incomplete string because temp2 is not a zero-terminated string, it
can contain zeros in the middle.

> Trying to access memory locations outside whatever is allocated by the return 
> of sqlite3_column_text sounds like it would result in undefined behavior?

How do you know how much memory sqlite3_column_text allocated for the return?

> sqlite3_column_bytes returns 8960 if that's helpful.

Hint: the above number means that sqlite3_column_text allocated
exactly 8960 bytes for the text it returned. So whatever you use to
define that returned text is incomplete gives you incorrect
information.


Pavel
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to