SRS 6.0-b0 源码 + danmaku 后端(排除 objs/3rdparty/测试媒体)
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
.PHONY: default clean
|
||||
|
||||
default: heap_defense
|
||||
|
||||
heap_defense: heap_defense.cc Makefile
|
||||
g++ -o heap_defense heap_defense.cc -g -O0 -ansi \
|
||||
-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free \
|
||||
-I../../../objs/gperf/include ../../../objs/gperf/lib/libtcmalloc_debug.a -lpthread
|
||||
clean:
|
||||
rm -rf heap_defense ./*.dSYM
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// Copyright (c) 2013-2025 Winlin
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
/**
|
||||
@see: https://blog.csdn.net/win_lin/article/details/50461709
|
||||
config srs with gperf(to make gperftools):
|
||||
./configure --gperf=on --gmd=on --jobs=3
|
||||
to check mem corruption:
|
||||
make && env TCMALLOC_PAGE_FENCE=1 ./heap_defense
|
||||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
void foo(char* buf) {
|
||||
buf[16] = 0x0f;
|
||||
}
|
||||
|
||||
void bar(char* buf) {
|
||||
printf("buf[15]=%#x\n", (unsigned char)buf[15]);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
char* buf = new char[16];
|
||||
foo(buf);
|
||||
bar(buf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user