diff --git a/util/RTCContext.cpp b/util/RTCContext.cpp index 1c1d06b..4fde7cb 100644 --- a/util/RTCContext.cpp +++ b/util/RTCContext.cpp @@ -202,6 +202,12 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId, reinterpret_cast(numpyApi_[93]); std::cout << " 函数地址: " << (void*)PyArray_SimpleNew << std::endl; + std::cout << "[5.1] 验证函数指针..." << std::endl; + void* func_ptr = numpyApi_[93]; + if (reinterpret_cast(func_ptr) < 0x1000) { // 检查是否为合法地址 + std::cerr << "非法函数指针: " << func_ptr << std::endl; + throw std::runtime_error("Invalid PyArray_SimpleNew pointer"); + } // 6. 创建NumPy数组 std::cout << "[6] 创建NumPy数组..." << std::endl; PyObject* pyArray = PyArray_SimpleNew(1, dims, NPY_INT16);