Re: [edk2] [Patch] MdeModulePkg: Fix a performance data buffer overrun issue
On 2015/9/9 13:36, Ruiyu Ni wrote: The mBmPerfHeader.Count isn't reset to 0 in BmWriteBootToOsPerformanceData() so when the actual performance data entry count exceeds the LimitCount, the performance data collection breaks on condition if (mBmPerfHeader.Count == LimitCount), but 2nd time calling this function will not break on condition if (mBmPerfHeader.Count == LimitCount) because the mBmPerfHeader.Count always bigger than LimitCount, which results buffer overrun. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu NiCc: Star Zeng --- MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c | 5 + 1 file changed, 5 insertions(+) Reviewed-by: Star Zeng diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c b/MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c index 7b13ec6..e45c0bd 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c @@ -186,6 +186,11 @@ BmWriteBootToOsPerformanceData ( PERF_END(NULL, "BDS", NULL, 0); // + // Reset the entry count + // + mBmPerfHeader.Count = 0; + + // // Retrieve time stamp count as early as possible // Ticker = GetPerformanceCounter (); ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] MdeModulePkg: Fix a performance data buffer overrun issue
The mBmPerfHeader.Count isn't reset to 0 in BmWriteBootToOsPerformanceData() so when the actual performance data entry count exceeds the LimitCount, the performance data collection breaks on condition if (mBmPerfHeader.Count == LimitCount), but 2nd time calling this function will not break on condition if (mBmPerfHeader.Count == LimitCount) because the mBmPerfHeader.Count always bigger than LimitCount, which results buffer overrun. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu NiCc: Star Zeng --- MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c | 5 + 1 file changed, 5 insertions(+) diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c b/MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c index 7b13ec6..e45c0bd 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c @@ -186,6 +186,11 @@ BmWriteBootToOsPerformanceData ( PERF_END(NULL, "BDS", NULL, 0); // + // Reset the entry count + // + mBmPerfHeader.Count = 0; + + // // Retrieve time stamp count as early as possible // Ticker = GetPerformanceCounter (); -- 1.9.5.msysgit.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel