Valgrind: Return error for unsupported check=new on Valgrind < 3.21. v7.0.52 (#4301)
## Problem The `valgrind?check=new` API parameter uses `VALGRIND_DO_NEW_LEAK_CHECK` which is only available in Valgrind 3.21+. On older versions like CentOS's default Valgrind 3.16, this causes undefined behavior since the macro is not defined. ## Solution - Check for `VALGRIND_DO_NEW_LEAK_CHECK` availability before processing the request - Return `ERROR_NOT_SUPPORTED` with version information when unsupported - Move the version check before thread creation to avoid unnecessary resource allocation ## Changes - Early validation of `check=new` parameter compatibility - Proper error response with current Valgrind version details - Prevents undefined behavior on older Valgrind installations Fixes compatibility issues with older Valgrind versions commonly found in enterprise Linux distributions. --------- Co-authored-by: Jacob Su <suzp1984@gmail.com> Co-authored-by: winlin <winlinvip@gmail.com> Co-authored-by: OSSRS-AI <winlinam@gmail.com>
This commit is contained in:
parent
f2e56c7e83
commit
db5e43967c
|
|
@ -7,6 +7,7 @@ The changelog for SRS.
|
|||
<a name="v7-changes"></a>
|
||||
|
||||
## SRS 7.0 Changelog
|
||||
* v7.0, 2025-08-12, Merge [#4301](https://github.com/ossrs/srs/pull/4301): Valgrind: Return error for unsupported check=new on Valgrind < 3.21. v7.0.52 (#4301)
|
||||
* v7.0, 2025-08-12, Merge [#4431](https://github.com/ossrs/srs/pull/4431): fix srt cmake 4.x compiling error. v7.0.52 (#4431)
|
||||
* v7.0, 2025-08-11, Merge [#4433](https://github.com/ossrs/srs/pull/4433): Use clang format. v7.0.52 (#4433)
|
||||
* v7.0, 2025-08-11, Merge [#4159](https://github.com/ossrs/srs/pull/4159): Feature: Support HLS with fmp4 segment for HEVC/LLHLS. v7.0.51 (#4159)
|
||||
|
|
|
|||
|
|
@ -1118,13 +1118,6 @@ srs_error_t SrsGoApiValgrind::serve_http(ISrsHttpResponseWriter *w, ISrsHttpMess
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
if (!trd_) {
|
||||
trd_ = new SrsSTCoroutine("valgrind", this, _srs_context->get_id());
|
||||
if ((err = trd_->start()) != srs_success) {
|
||||
return srs_error_wrap(err, "start");
|
||||
}
|
||||
}
|
||||
|
||||
string check = r->query_get("check");
|
||||
srs_trace("query check=%s", check.c_str());
|
||||
|
||||
|
|
@ -1134,6 +1127,22 @@ srs_error_t SrsGoApiValgrind::serve_http(ISrsHttpResponseWriter *w, ISrsHttpMess
|
|||
check = "full";
|
||||
}
|
||||
|
||||
// Check if 'new' leak check is supported in current Valgrind version
|
||||
if (check == "new") {
|
||||
#if !defined(VALGRIND_DO_NEW_LEAK_CHECK)
|
||||
return srs_error_new(ERROR_NOT_SUPPORTED,
|
||||
"valgrind?check=new requires Valgrind 3.21+, current version is %d.%d",
|
||||
__VALGRIND_MAJOR__, __VALGRIND_MINOR__);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!trd_) {
|
||||
trd_ = new SrsSTCoroutine("valgrind", this, _srs_context->get_id());
|
||||
if ((err = trd_->start()) != srs_success) {
|
||||
return srs_error_wrap(err, "start");
|
||||
}
|
||||
}
|
||||
|
||||
// By default, response the json style response.
|
||||
SrsUniquePtr<SrsJsonObject> obj(SrsJsonAny::object());
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,8 @@
|
|||
XX(ERROR_SYSTEM_FILE_SETVBUF, 1096, "FileSetVBuf", "Failed to set file vbuf") \
|
||||
XX(ERROR_NO_SOURCE, 1097, "NoSource", "No source found") \
|
||||
XX(ERROR_STREAM_DISPOSING, 1098, "StreamDisposing", "Stream is disposing") \
|
||||
XX(ERROR_NOT_IMPLEMENTED, 1099, "NotImplemented", "Feature is not implemented")
|
||||
XX(ERROR_NOT_IMPLEMENTED, 1099, "NotImplemented", "Feature is not implemented") \
|
||||
XX(ERROR_NOT_SUPPORTED, 1100, "NotSupported", "Feature is not supported")
|
||||
|
||||
/**************************************************/
|
||||
/* RTMP protocol error. */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user