Skip to content

Commit 8debbe6

Browse files
committed
Asan: Fix utest bug.
1 parent f316e9a commit 8debbe6

File tree

2 files changed

+48
-47
lines changed

2 files changed

+48
-47
lines changed

trunk/ide/srs_clion/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ TARGET_LINK_LIBRARIES(srs dl)
8888
TARGET_LINK_LIBRARIES(srs ${DEPS_LIBS})
8989
TARGET_LINK_LIBRARIES(srs -ldl -pthread)
9090
TARGET_LINK_LIBRARIES(srs -rdynamic)
91+
TARGET_LINK_LIBRARIES(srs -fsanitize=address -fno-omit-frame-pointer)
9192

9293
###########################################################
9394
# For utest.
@@ -109,5 +110,5 @@ TARGET_LINK_LIBRARIES(utest -fsanitize=address -fno-omit-frame-pointer)
109110

110111
###########################################################
111112
# Done
112-
MESSAGE(STATUS "@see https://ossrs.net/lts/zh-cn/docs/v4/doc/ide")
113+
MESSAGE(STATUS "@see https://ossrs.net/lts/zh-cn/docs/v5/doc/ide")
113114

trunk/src/utest/srs_utest_kernel2.cpp

+46-46
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,24 @@ VOID TEST(KernelPSTest, PsPacketDecodeNormal)
2323
// PT=DynamicRTP-Type-96, SSRC=0xBEBDFA1, Seq=0, Time=0
2424
if (true) {
2525
SrsRtpPacket rtp;
26+
string raw = string(
27+
"\x80\x60\x00\x00\x00\x00\x00\x00\x0b\xeb\xdf\xa1\x00\x00\x01\xba" \
28+
"\x44\x68\x6e\x4c\x94\x01\x01\x30\x13\xfe\xff\xff\x00\x00\xa0\x05" \
29+
"\x00\x00\x01\xbb\x00\x12\x80\x98\x09\x04\xe1\x7f\xe0\xe0\x80\xc0" \
30+
"\xc0\x08\xbd\xe0\x80\xbf\xe0\x80\x00\x00\x01\xbc\x00\x5e\xfc\xff" \
31+
"\x00\x24\x40\x0e\x48\x4b\x01\x00\x16\x9b\xa5\x22\x2e\xf7\x00\xff" \
32+
"\xff\xff\x41\x12\x48\x4b\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09" \
33+
"\x0a\x0b\x0c\x0d\x0e\x0f\x00\x30\x1b\xe0\x00\x1c\x42\x0e\x07\x10" \
34+
"\x10\xea\x02\x80\x01\xe0\x11\x30\x00\x00\x1c\x20\x2a\x0a\x7f\xff" \
35+
"\x00\x00\x07\x08\x1f\xfe\x50\x3c\x0f\xc0\x00\x0c\x43\x0a\x00\x90" \
36+
"\xfe\x02\xb1\x13\x01\xf4\x03\xff\xcb\x85\x54\xb9\x00\x00\x01\xe0" \
37+
"\x00\x26\x8c\x80\x07\x21\x1a\x1b\x93\x25\xff\xfc\x00\x00\x00\x01" \
38+
"\x67\x4d\x00\x1e\x9d\xa8\x28\x0f\x69\xb8\x08\x08\x0a\x00\x00\x03" \
39+
"\x00\x02\x00\x00\x03\x00\x65\x08\x00\x00\x01\xe0\x00\x0e\x8c\x00" \
40+
"\x03\xff\xff\xfc\x00\x00\x00\x01\x68\xee\x3c\x80\x00\x00\x01\xe0" \
41+
"\x00\x0e\x8c\x00\x02\xff\xfc\x00\x00\x00\x01\x06\xe5\x01\xba\x80" \
42+
"\x00\x00\x01\xe0\x35\x62\x8c\x00\x02\xff\xf8\x00\x00\x00\x01\x65", 256) + string(1156, 'x');
2643
if (true) {
27-
string raw = string(
28-
"\x80\x60\x00\x00\x00\x00\x00\x00\x0b\xeb\xdf\xa1\x00\x00\x01\xba" \
29-
"\x44\x68\x6e\x4c\x94\x01\x01\x30\x13\xfe\xff\xff\x00\x00\xa0\x05" \
30-
"\x00\x00\x01\xbb\x00\x12\x80\x98\x09\x04\xe1\x7f\xe0\xe0\x80\xc0" \
31-
"\xc0\x08\xbd\xe0\x80\xbf\xe0\x80\x00\x00\x01\xbc\x00\x5e\xfc\xff" \
32-
"\x00\x24\x40\x0e\x48\x4b\x01\x00\x16\x9b\xa5\x22\x2e\xf7\x00\xff" \
33-
"\xff\xff\x41\x12\x48\x4b\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09" \
34-
"\x0a\x0b\x0c\x0d\x0e\x0f\x00\x30\x1b\xe0\x00\x1c\x42\x0e\x07\x10" \
35-
"\x10\xea\x02\x80\x01\xe0\x11\x30\x00\x00\x1c\x20\x2a\x0a\x7f\xff" \
36-
"\x00\x00\x07\x08\x1f\xfe\x50\x3c\x0f\xc0\x00\x0c\x43\x0a\x00\x90" \
37-
"\xfe\x02\xb1\x13\x01\xf4\x03\xff\xcb\x85\x54\xb9\x00\x00\x01\xe0" \
38-
"\x00\x26\x8c\x80\x07\x21\x1a\x1b\x93\x25\xff\xfc\x00\x00\x00\x01" \
39-
"\x67\x4d\x00\x1e\x9d\xa8\x28\x0f\x69\xb8\x08\x08\x0a\x00\x00\x03" \
40-
"\x00\x02\x00\x00\x03\x00\x65\x08\x00\x00\x01\xe0\x00\x0e\x8c\x00" \
41-
"\x03\xff\xff\xfc\x00\x00\x00\x01\x68\xee\x3c\x80\x00\x00\x01\xe0" \
42-
"\x00\x0e\x8c\x00\x02\xff\xfc\x00\x00\x00\x01\x06\xe5\x01\xba\x80" \
43-
"\x00\x00\x01\xe0\x35\x62\x8c\x00\x02\xff\xf8\x00\x00\x00\x01\x65", 256) + string(1156, 'x');
4444
SrsBuffer b((char*)raw.data(), raw.length());
4545
HELPER_ASSERT_SUCCESS(rtp.decode(&b));
4646
}
@@ -64,8 +64,8 @@ VOID TEST(KernelPSTest, PsPacketDecodeNormal)
6464
// PT=DynamicRTP-Type-96, SSRC=0xBEBDFA1, Seq=8, Time=0
6565
for (int i = 0; i < 8; i++) {
6666
SrsRtpPacket rtp;
67+
string raw = string("\x80\x60\x00\x01\x00\x00\x00\x00\x0b\xeb\xdf\xa1", 12) + string(1400, 'x');
6768
if (true) {
68-
string raw = string("\x80\x60\x00\x01\x00\x00\x00\x00\x0b\xeb\xdf\xa1", 12) + string(1400, 'x');
6969
SrsBuffer b((char*)raw.data(), raw.length());
7070
HELPER_ASSERT_SUCCESS(rtp.decode(&b));
7171
}
@@ -81,15 +81,15 @@ VOID TEST(KernelPSTest, PsPacketDecodeNormal)
8181
// PT=DynamicRTP-Type-96, SSRC=0xBEBDFA1, Seq=9, Time=0
8282
if (true) {
8383
SrsRtpPacket rtp;
84+
string raw = string("\x80\x60\x00\x09\x00\x00\x00\x00\x0b\xeb\xdf\xa1", 12) + string(1300, 'x')
85+
+ string("\x00\x00\x01\xbd\x00\x6a\x8c\x80\x07\x21\x1a\x1b\x93\x25\xff\xf8" \
86+
"\x00\x02\x00\x17\x00\x01\x80\x00\x00\xff\xa0\x05\xe0\xf1\xf0\x50" \
87+
"\x18\x52\xd6\x5c\xa2\x78\x90\x23\xf9\xf6\x64\xba\xc7\x90\x5e\xd3" \
88+
"\x80\x2f\x29\xad\x06\xee\x14\x62\xec\x6f\x77\xaa\x71\x80\xb3\x50" \
89+
"\xb8\xd1\x85\x7f\x44\x30\x4f\x44\xfd\xcd\x21\xe6\x55\x36\x08\x6c" \
90+
"\xb8\xd1\x85\x7f\x44\x30\x4f\x44\xfd\xcd\x21\xe6\x55\x36\x08\x6c" \
91+
"\xc9\xf6\x5c\x74", 100);
8492
if (true) {
85-
string raw = string("\x80\x60\x00\x09\x00\x00\x00\x00\x0b\xeb\xdf\xa1", 12) + string(1300, 'x')
86-
+ string("\x00\x00\x01\xbd\x00\x6a\x8c\x80\x07\x21\x1a\x1b\x93\x25\xff\xf8" \
87-
"\x00\x02\x00\x17\x00\x01\x80\x00\x00\xff\xa0\x05\xe0\xf1\xf0\x50" \
88-
"\x18\x52\xd6\x5c\xa2\x78\x90\x23\xf9\xf6\x64\xba\xc7\x90\x5e\xd3" \
89-
"\x80\x2f\x29\xad\x06\xee\x14\x62\xec\x6f\x77\xaa\x71\x80\xb3\x50" \
90-
"\xb8\xd1\x85\x7f\x44\x30\x4f\x44\xfd\xcd\x21\xe6\x55\x36\x08\x6c" \
91-
"\xb8\xd1\x85\x7f\x44\x30\x4f\x44\xfd\xcd\x21\xe6\x55\x36\x08\x6c" \
92-
"\xc9\xf6\x5c\x74", 100);
9393
SrsBuffer b((char*)raw.data(), raw.length());
9494
HELPER_ASSERT_SUCCESS(rtp.decode(&b));
9595
}
@@ -105,9 +105,9 @@ VOID TEST(KernelPSTest, PsPacketDecodeNormal)
105105
// PT=DynamicRTP-Type-96, SSRC=0xBEBDFA1, Seq=10, Time=0
106106
if (true) {
107107
SrsRtpPacket rtp;
108+
string raw("\x80\x60\x00\x0a\x00\x00\x00\x00\x0b\xeb\xdf\xa1" \
109+
"\x57\xb3\xa3\xbc\x16\x2c\x3c\x9e\x69\x89\x48\xa4", 24);
108110
if (true) {
109-
string raw("\x80\x60\x00\x0a\x00\x00\x00\x00\x0b\xeb\xdf\xa1" \
110-
"\x57\xb3\xa3\xbc\x16\x2c\x3c\x9e\x69\x89\x48\xa4", 24);
111111
SrsBuffer b((char*)raw.data(), raw.length());
112112
HELPER_ASSERT_SUCCESS(rtp.decode(&b));
113113
}
@@ -123,13 +123,13 @@ VOID TEST(KernelPSTest, PsPacketDecodeNormal)
123123
// PT=DynamicRTP-Type-96, SSRC=0xBEBDFA1, Seq=11, Time=3600
124124
if (true) {
125125
SrsRtpPacket rtp;
126+
string raw = string("\x80\x60\x00\x0b\x00\x00\x0e\x10\x0b\xeb\xdf\xa1", 12)
127+
+ string("\x00\x00\x01\xc0" \
128+
"\x00\x82\x8c\x80\x09\x21\x1a\x1b\xa3\x51\xff\xff\xff\xf8\xff\xf9" \
129+
"\x50\x40\x0e\xdf\xfc\x01\x2c\x2e\x84\x28\x23\x0a\x85\x82\xa2\x40" \
130+
"\x90\x50\x2c\x14\x0b\x05\x42\x41\x30\x90\x44\x28\x16\x08\x84\x82", 52)
131+
+ string(84, 'x');
126132
if (true) {
127-
string raw = string("\x80\x60\x00\x0b\x00\x00\x0e\x10\x0b\xeb\xdf\xa1", 12)
128-
+ string("\x00\x00\x01\xc0" \
129-
"\x00\x82\x8c\x80\x09\x21\x1a\x1b\xa3\x51\xff\xff\xff\xf8\xff\xf9" \
130-
"\x50\x40\x0e\xdf\xfc\x01\x2c\x2e\x84\x28\x23\x0a\x85\x82\xa2\x40" \
131-
"\x90\x50\x2c\x14\x0b\x05\x42\x41\x30\x90\x44\x28\x16\x08\x84\x82", 52)
132-
+ string(84, 'x');
133133
SrsBuffer b((char*)raw.data(), raw.length());
134134
HELPER_ASSERT_SUCCESS(rtp.decode(&b));
135135
}
@@ -145,13 +145,13 @@ VOID TEST(KernelPSTest, PsPacketDecodeNormal)
145145
// PT=DynamicRTP-Type-96, SSRC=0xBEBDFA1, Seq=12, Time=3600
146146
if (true) {
147147
SrsRtpPacket rtp;
148+
string raw = string("\x80\x60\x00\x0c\x00\x00\x0e\x10\x0b\xeb\xdf\xa1", 12)
149+
+ string("\x00\x00\x01\xc0" \
150+
"\x00\x8a\x8c\x80\x09\x21\x1a\x1b\xb3\x7d\xff\xff\xff\xf8\xff\xf9" \
151+
"\x50\x40\x0f\xdf\xfc\x01\x2c\x2e\x88\x2a\x13\x0a\x09\x82\x41\x10" \
152+
"\x90\x58\x26\x14\x13\x05\x02\xc2\x10\xa0\x58\x4a\x14\x0a\x85\x02", 52)
153+
+ string(92, 'x');
148154
if (true) {
149-
string raw = string("\x80\x60\x00\x0c\x00\x00\x0e\x10\x0b\xeb\xdf\xa1", 12)
150-
+ string("\x00\x00\x01\xc0" \
151-
"\x00\x8a\x8c\x80\x09\x21\x1a\x1b\xb3\x7d\xff\xff\xff\xf8\xff\xf9" \
152-
"\x50\x40\x0f\xdf\xfc\x01\x2c\x2e\x88\x2a\x13\x0a\x09\x82\x41\x10" \
153-
"\x90\x58\x26\x14\x13\x05\x02\xc2\x10\xa0\x58\x4a\x14\x0a\x85\x02", 52)
154-
+ string(92, 'x');
155155
SrsBuffer b((char*)raw.data(), raw.length());
156156
HELPER_ASSERT_SUCCESS(rtp.decode(&b));
157157
}
@@ -167,13 +167,13 @@ VOID TEST(KernelPSTest, PsPacketDecodeNormal)
167167
// PT=DynamicRTP-Type-96, SSRC=0xBEBDFA1, Seq=13, Time=3600
168168
if (true) {
169169
SrsRtpPacket rtp;
170+
string raw = string("\x80\x60\x00\x0d\x00\x00\x0e\x10\x0b\xeb\xdf\xa1", 12)
171+
+ string("\x00\x00\x01\xba" \
172+
"\x44\x68\x6e\xbd\x14\x01\x01\x30\x13\xfe\xff\xff\x00\x00\xa0\x06" \
173+
"\x00\x00\x01\xe0\x03\x4a\x8c\x80\x08\x21\x1a\x1b\xaf\x45\xff\xff" \
174+
"\xf8\x00\x00\x00\x01\x61\xe0\x08\xbf\x3c\xb6\x63\x68\x4b\x7f\xea", 52)
175+
+ string(816, 'x');
170176
if (true) {
171-
string raw = string("\x80\x60\x00\x0d\x00\x00\x0e\x10\x0b\xeb\xdf\xa1", 12)
172-
+ string("\x00\x00\x01\xba" \
173-
"\x44\x68\x6e\xbd\x14\x01\x01\x30\x13\xfe\xff\xff\x00\x00\xa0\x06" \
174-
"\x00\x00\x01\xe0\x03\x4a\x8c\x80\x08\x21\x1a\x1b\xaf\x45\xff\xff" \
175-
"\xf8\x00\x00\x00\x01\x61\xe0\x08\xbf\x3c\xb6\x63\x68\x4b\x7f\xea", 52)
176-
+ string(816, 'x');
177177
SrsBuffer b((char*)raw.data(), raw.length());
178178
HELPER_ASSERT_SUCCESS(rtp.decode(&b));
179179
}

0 commit comments

Comments
 (0)