We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8ac81b7 commit 3c2c129Copy full SHA for 3c2c129
src/torchcodec/decoders/_core/FFMPEGCommon.cpp
@@ -69,6 +69,12 @@ AVIOContext* AVIOBytesContext::getAVIO() {
69
int AVIOBytesContext::read(void* opaque, uint8_t* buf, int buf_size) {
70
struct AVIOBufferData* bufferData =
71
static_cast<struct AVIOBufferData*>(opaque);
72
+ TORCH_CHECK(
73
+ bufferData->current <= bufferData->size,
74
+ "Tried to read outside of the buffer: current=",
75
+ bufferData->current,
76
+ ", size=",
77
+ bufferData->size);
78
buf_size = FFMIN(buf_size, bufferData->size - bufferData->current);
79
TORCH_CHECK(
80
buf_size >= 0,
0 commit comments