gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] [bug #32732] Assertion `std::ftell(_data) == pos' failed.


From: Bastiaan Jacques
Subject: [Gnash-commit] [bug #32732] Assertion `std::ftell(_data) == pos' failed. in tu_file.cpp:182
Date: Thu, 10 Mar 2011 11:22:38 +0000
User-agent: Mozilla/5.0 (X11; Linux i686; rv:2.0b12) Gecko/20100101 Firefox/4.0b12

Follow-up Comment #7, bug #32732 (project gnash):

Ah! Then this is a simple case of buffer overflow.

I think the bug is in tu_file::seek(std::streampos pos).

On your 64-bit machine size_t is a 64-bit integer, so that the following
line:

    if (static_cast<size_t>(pos) > size()) return false;

actually returns false, because the file size is too large. So that's why you
can't reproduce the assertion on the 64-bit machine.

On the 32-bit machine, the 64-bit integer (std::streampos) overflows in the
static_cast to size_t, which is 32-bits. It then becomes a relatively small
number, which is a reasonable number for a file size.

In the call to fseek, the integer again gets cast to a long (32-bit), again
turning it into a small number.

A little while later the assertion compares the original streampos (a very
large number) to the current file position, and lo and behold, it is not where
it is supposed to be.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?32732>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]