[x265] [PATCH] fix(encoder): correct size check in fetchStats
yuygfgg
leoyuygfgg at gmail.com
Wed Jun 11 13:55:30 UTC 2025
In Encoder::fetchStats, the size check for the stats buffer was
incorrectly using sizeof(stats) on the x265_stats pointer. This
evaluates to the size of a pointer, not the size of the structure
it points to.
This commit changes the check to sizeof(*stats) to correctly
compare against the size of the x265_stats structure.
Signed-off-by: yuygfgg <leoyuygfgg at gmail.com>
---
source/encoder/encoder.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
index cf2e95988..be898cbbf 100644
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -2963,7 +2963,7 @@ void Encoder::printSummary()
void Encoder::fetchStats(x265_stats *stats, size_t statsSizeBytes, int layer)
{
- if (statsSizeBytes >= sizeof(stats))
+ if (statsSizeBytes >= sizeof(*stats))
{
stats->globalPsnrY = m_analyzeAll[layer].m_psnrSumY;
stats->globalPsnrU = m_analyzeAll[layer].m_psnrSumU;
--
2.49.0
More information about the x265-devel
mailing list