From: Aditya Agarwal Date: Tue, 27 Feb 2007 00:07:45 +0000 (+0000) Subject: -- fix overflow error in seekToChunk() X-Git-Tag: 0.2.0~1452 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=49aea10d7a3f189cceb0459d8a05ef64dd76e23e;p=common%2Fthrift.git -- fix overflow error in seekToChunk() Summary: - I love finding overflow errors. Reviewed By: jwang Test Plan: tested by rolling back search logfile Notes: - This should not affect anything currently in production. git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665020 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/cpp/src/transport/TFileTransport.cpp b/lib/cpp/src/transport/TFileTransport.cpp index 3f625bc4..a9f3e9ee 100644 --- a/lib/cpp/src/transport/TFileTransport.cpp +++ b/lib/cpp/src/transport/TFileTransport.cpp @@ -630,7 +630,8 @@ void TFileTransport::seekToChunk(int32_t chunk) { minEndOffset = lseek(fd_, 0, SEEK_END); } - offset_ = lseek(fd_, chunk * chunkSize_, SEEK_SET); + off_t newOffset = off_t(chunk) * chunkSize_; + offset_ = lseek(fd_, newOffset, SEEK_SET); readState_.resetAllValues(); if (offset_ == -1) { perror("TFileTransport: lseek error in seekToChunk");