Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
Torchaudio
Commits
f5377999
Unverified
Commit
f5377999
authored
Feb 04, 2021
by
moto
Committed by
GitHub
Feb 04, 2021
Browse files
Fix mixed signed/un-signed comparison in effects_chain (#1236)
parent
135e966d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
torchaudio/csrc/sox/effects_chain.cpp
torchaudio/csrc/sox/effects_chain.cpp
+6
-2
No files found.
torchaudio/csrc/sox/effects_chain.cpp
View file @
f5377999
...
...
@@ -353,7 +353,11 @@ int fileobj_input_drain(sox_effect_t* effp, sox_sample_t* obuf, size_t* osamp) {
// in sync and `tell_off` has seemingly uninitialized value, which
// leads num_remain to be negative and cause segmentation fault
// in `memmove`.
const
auto
num_consumed
=
ftell
((
FILE
*
)
sf
->
fp
);
const
auto
tell
=
ftell
((
FILE
*
)
sf
->
fp
);
if
(
tell
<
0
)
{
throw
std
::
runtime_error
(
"Internal Error: ftell failed."
);
}
const
auto
num_consumed
=
static_cast
<
size_t
>
(
tell
);
if
(
num_consumed
>
priv
->
buffer_size
)
{
throw
std
::
runtime_error
(
"Internal Error: buffer overrun."
);
}
...
...
@@ -361,7 +365,7 @@ int fileobj_input_drain(sox_effect_t* effp, sox_sample_t* obuf, size_t* osamp) {
const
auto
num_remain
=
priv
->
buffer_size
-
num_consumed
;
// 1.1. Fetch the data to see if there is data to fill the buffer
uint64
_t
num_refill
=
0
;
size
_t
num_refill
=
0
;
std
::
string
chunk
(
num_consumed
,
'\0'
);
if
(
num_consumed
&&
!
priv
->
eof_reached
)
{
num_refill
=
read_fileobj
(
...
...
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