Kristian Nielsen wrote:
Philip Herron <[email protected]> writes:

@@ -149,11 +149,11 @@
while (1)
{
off_t length;
- char *buffer= NULL;
+ char *buffer=(char*)malloc(sizeof(char));
char *temp_buffer;

/* Read the size */
- if (read(file, &length, sizeof(uint64_t)) != sizeof(uint64_t))
+ if (read(file, &length, sizeof(uint32_t)) != sizeof(uint32_t))
break;

temp_buffer= (char *)realloc(buffer, length);

I guess its because the length is off_t which is just: typedef long off_t
so its still 32bit and therefore too small to read a 64bit int into or
something along those lines.

Well, long is 32 bit on 32-bit Linux, but 64 bit on 64-bit linux. So this is
going to fail on 64-bit (big-endian for sure, and probably also
little-endian).

And surely the actual size of the number to read depends not on whatever
sizeof(off_t) is, but on what is actually in the file being read? So why not
read the value into a tmp variable of correct size (uint32_t or uint64_t
depending on file format), and afterwards assign to length (checking for
overflow if needed)?

Hope this helps,

 - Kristian.
Hey

Ah yeah that makes more sense, i guess that would be a better idea! Read to figure out what 'endian' were in and read for that!

Hmm.. even with that i am still having problems running drizzled with the error's i posted before!

-Phil

_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to