Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhongxiao
OpenXG-RAN
Commits
65c64564
Commit
65c64564
authored
Feb 17, 2022
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve buffer overflows polartest
parent
3e2c9af1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
openair1/PHY/CODING/TESTBENCH/polartest.c
openair1/PHY/CODING/TESTBENCH/polartest.c
+13
-8
No files found.
openair1/PHY/CODING/TESTBENCH/polartest.c
View file @
65c64564
...
@@ -158,14 +158,19 @@ if (logFlag){
...
@@ -158,14 +158,19 @@ if (logFlag){
#endif
#endif
}
}
uint8_t
testArrayLength
=
ceil
(
testLength
/
32
.
0
);
const
uint8_t
testArrayLength
=
ceil
(
testLength
/
32
.
0
);
uint8_t
coderArrayLength
=
ceil
(
coderLength
/
32
.
0
);
const
uint8_t
coderArrayLength
=
ceil
(
coderLength
/
32
.
0
);
uint32_t
testInput
[
max
(
2
,
testArrayLength
)];
//generate randomly
// in the polar code, often uint64_t arrays are used, but we work with
// uint32_t arrays below, so realArrayLength is the length that always
// satisfies uint64_t array length
const
uint8_t
realArrayLength
=
((
testArrayLength
+
1
)
/
2
)
*
2
;
printf
(
"testArrayLength %d realArrayLength %d
\n
"
,
testArrayLength
,
realArrayLength
);
uint32_t
testInput
[
realArrayLength
];
//generate randomly
uint32_t
encoderOutput
[
coderArrayLength
];
uint32_t
encoderOutput
[
coderArrayLength
];
uint32_t
estimatedOutput
[
test
ArrayLength
];
//decoder output
uint32_t
estimatedOutput
[
real
ArrayLength
];
//decoder output
memset
(
testInput
,
0
,
sizeof
(
uint32_t
)
*
testArrayLength
);
memset
(
testInput
,
0
,
sizeof
(
uint32_t
)
*
realArrayLength
);
// does not reset all
memset
(
encoderOutput
,
0
,
sizeof
(
uint32_t
)
*
coderArrayLength
);
memset
(
encoderOutput
,
0
,
sizeof
(
uint32_t
)
*
coderArrayLength
);
memset
(
estimatedOutput
,
0
,
sizeof
(
uint32_t
)
*
test
ArrayLength
);
memset
(
estimatedOutput
,
0
,
sizeof
(
uint32_t
)
*
real
ArrayLength
);
uint8_t
encoderOutputByte
[
coderLength
];
uint8_t
encoderOutputByte
[
coderLength
];
double
modulatedInput
[
coderLength
];
//channel input
double
modulatedInput
[
coderLength
];
//channel input
double
channelOutput
[
coderLength
];
//add noise
double
channelOutput
[
coderLength
];
//add noise
...
@@ -334,9 +339,9 @@ if (logFlag){
...
@@ -334,9 +339,9 @@ if (logFlag){
decoderState
=
0
;
decoderState
=
0
;
nBitError
=
0
;
nBitError
=
0
;
blockErrorState
=
0
;
blockErrorState
=
0
;
memset
(
testInput
,
0
,
sizeof
(
uint32_t
)
*
test
ArrayLength
);
memset
(
testInput
,
0
,
sizeof
(
uint32_t
)
*
real
ArrayLength
);
memset
(
encoderOutput
,
0
,
sizeof
(
uint32_t
)
*
coderArrayLength
);
memset
(
encoderOutput
,
0
,
sizeof
(
uint32_t
)
*
coderArrayLength
);
memset
(
estimatedOutput
,
0
,
sizeof
(
uint32_t
)
*
test
ArrayLength
);
memset
(
estimatedOutput
,
0
,
sizeof
(
uint32_t
)
*
real
ArrayLength
);
}
}
//Calculate error statistics for the SNR.
//Calculate error statistics for the SNR.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment