Status: New
Owner: liuj...@google.com
Labels: Type-Defect Priority-Medium

New issue 302 by fac2...@gmail.com: Skip(count) fails when count offset
2^32 count type should be off_t, not int
http://code.google.com/p/protobuf/issues/detail?id=302

What steps will reproduce the problem?
1. Pick a file larger than 2,150,000,000 bytes (~2GB), initialize a file descriptor fd

2. google::protobuf::io::ZeroCopyInputStream *input_stream = new google::protobuf::io::FileInputStream(fd);

3.  off_t offset=2150000000; (offset does not fit in 32 bits)

4.  input_streadm->Skip(offset); will yield:

libprotobuf FATAL google/protobuf/io/zero_copy_stream_impl_lite.cc:268] CHECK failed: (count) >= (0):

What is the expected output? What do you see instead?

The Skip method should position the stream at the specified offset. Instead an assertion is raised when the compiler casts the off_t offset to an int (which becomes negative).

What version of the product are you using? On what operating system?

protobuff 2.3.0, on linux, compiling with gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46) The latest version of protobuff is expected to have the same problem since the Skip method signature appears unchanged in source control.

Suggested resolution: define the Skip method signature with the off_t type, rather than the 32 bit int type.


--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to