Bug in MoveMfxBitstream (sample_utils.cpp) v5.0.337.79303

Bug in MoveMfxBitstream (sample_utils.cpp) v5.0.337.79303

Version: 5.0.337.79303
Project: sample_common
File: sample_utils.cpp
Function: MoveMfxBitstream

The function is supposed to move data from one mfxBitstream to another under the condition that there is enough free space (MaxLength - DataLength) in the target to take all of the remaining data (DataLength) of the source.

While the function does check if the free space of the target is large enough, it does not take into account that the target might NOT be empty when actually copying the data from source to target.

// Line: 555
// wrong
MSDK_MEMCPY_BITSTREAM(*pTarget, pTarget->DataOffset, pSrc->Data + pSrc->DataOffset, nBytes);

// correct
MSDK_MEMCPY_BITSTREAM(*pTarget, pTarget->DataOffset + pTarget->DataLength, pSrc->Data + pSrc->DataOffset, nBytes);


2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Thanks you!


Leave a Comment

Please sign in to add a comment. Not a member? Join today