projects
/
aubio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a2b1159
)
[tensor] add warning in get_shape_string snprintf
author
Paul Brossier
<piem@piem.org>
Wed, 29 Dec 2021 16:22:00 +0000
(11:22 -0500)
committer
Paul Brossier
<piem@piem.org>
Wed, 29 Dec 2021 16:52:03 +0000
(11:52 -0500)
Prevent gcc from emitting -Wformat-truncation warning
src/ai/tensor.c
patch
|
blob
|
history
diff --git
a/src/ai/tensor.c
b/src/ai/tensor.c
index
a15818e
..
8be5928
100644
(file)
--- a/
src/ai/tensor.c
+++ b/
src/ai/tensor.c
@@
-181,8
+181,10
@@
const char_t *aubio_tensor_get_shape_string(aubio_tensor_t *t) {
add_coma ? "," : "", add_space ? " " : "");
strncpy(shape_str_previous, shape_str, len);
}
- snprintf(shape_str, strnlen(shape_str, STRN_LENGTH - offset - 1) + offset,
- "%s)", shape_str_previous);
+ if (snprintf(shape_str,
+ strnlen(shape_str, STRN_LENGTH - offset - 1) + offset,
+ "%s)", shape_str_previous) < 0)
+ AUBIO_WRN("aubio_tensor_get_shape_string snprintf failed");
return shape_str;
}