Added return checks.
@@ -508,7 +508,10 @@ static UINT rdpgfx_write_h264_metablock(wStream* s, RDPGFX_H264_METABLOCK* meta)
RECTANGLE_16* regionRect;
RDPGFX_H264_QUANT_QUALITY* quantQualityVal;
UINT error = CHANNEL_RC_OK;
- Stream_EnsureRemainingCapacity(s, 4 + meta->numRegionRects * 10);
+
+ if (!Stream_EnsureRemainingCapacity(s, 4 + meta->numRegionRects * 10))
+ return ERROR_OUTOFMEMORY;
+
Stream_Write_UINT32(s, meta->numRegionRects); /* numRegionRects (4 bytes) */
for (index = 0; index < meta->numRegionRects; index++)
@@ -553,7 +556,9 @@ static INLINE UINT rdpgfx_write_h264_avc420(wStream* s,
return error;
}
- Stream_EnsureRemainingCapacity(s, havc420->length);
+ if (!Stream_EnsureRemainingCapacity(s, havc420->length))
+ return ERROR_OUTOFMEMORY;
+
Stream_Write(s, havc420->data, havc420->length);
return error;
}
