diff --git a/coders/dcm.c b/coders/dcm.c
index dd210b2..0f33995 100644
--- a/coders/dcm.c
+++ b/coders/dcm.c
@@ -3433,10 +3433,10 @@
stream_info->offset_count,sizeof(*stream_info->offsets));
if (stream_info->offsets == (ssize_t *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
- for (i=0; i < (long) stream_info->offsets; i++)
+ for (i=0; i < (long) stream_info->offset_count; i++)
stream_info->offsets[i]=(ssize_t) ReadBlobLSBLong(image);
offset=TellBlob(image);
- for (i=0; i < (long) stream_info->offsets; i++)
+ for (i=0; i < (long) stream_info->offset_count; i++)
stream_info->offsets[i]+=offset;
}
/*