diff --git a/libavformat/tta.c b/libavformat/tta.c
index 37a359bf70df6464b550253545bb0167e667edd8..f361ba5188235f760af538e945d7f3d7726d638a 100644
--- a/libavformat/tta.c
+++ b/libavformat/tta.c
@@ -125,7 +125,7 @@ static int tta_read_packet(AVFormatContext *s, AVPacket *pkt)
     int size, ret;
 
     // FIXME!
-    if (c->currentframe > c->totalframes)
+    if (c->currentframe >= c->totalframes)
         return -1;
 
     size = st->index_entries[c->currentframe].size;