Issue 1744 in webm: libvpx should compile with -Wformat-nonliteral

4 views
Skip to first unread message

ddkil… via monorail

unread,
Oct 26, 2021, 10:00:01 PM10/26/21
to webm-d...@webmproject.org
Status: Unconfirmed
Owner: ----

New issue 1744 by ddkil...@apple.com: libvpx should compile with -Wformat-nonliteral
https://bugs.chromium.org/p/webm/issues/detail?id=1744

libvpx should compile with -Wformat-nonliteral.

The only issue to fix (in the copy included in WebKit's source repository) is that `vpx_internal_error()` in `vpx/internal/vpx_codec_internal.h` needs to have a printf format attribute added to the function declaration similar to this:

```
#if defined(__clang__) || (defined(__GNUC__) && defined(__has_attribute))
#if __has_attribute(format)
#define LIBVPX_FORMAT_PRINTF(fmt, args) __attribute__((format(__printf__, fmt, args)))
#else
#define LIBVPX_FORMAT_PRINTF(fmt, args)
#endif
#else
#define LIBVPX_FORMAT_PRINTF(fmt, args)
#endif

void vpx_internal_error(struct vpx_internal_error_info *info,
vpx_codec_err_t error, const char *fmt,
...) LIBVPX_FORMAT_PRINTF(3, 4) CLANG_ANALYZER_NORETURN;
```

See the patch attached to:

WebKit Bug 232335: [WebRTC] Enable -Wformat=2 warnings
<https://bugs.webkit.org/show_bug.cgi?id=232335>

--
You received this message because:
1. The project was configured to send all issue notifications to this address

You may adjust your notification preferences at:
https://bugs.chromium.org/hosting/settings

jz… via monorail

unread,
Nov 2, 2021, 7:34:15 PM11/2/21
to webm-d...@webmproject.org
Updates:
Owner: jz...@google.com
Status: Assigned

Comment #1 on issue 1744 by jz...@google.com: libvpx should compile with -Wformat-nonliteral
https://bugs.chromium.org/p/webm/issues/detail?id=1744#c1

Thanks for the report. I can reproduce this and will send some changes for this library and libaom.

Git Watcher via monorail

unread,
Nov 4, 2021, 3:21:07 PM11/4/21
to webm-d...@webmproject.org
Updates:
Status: Fixed

Comment #3 on issue 1744 by Git Watcher: libvpx should compile with -Wformat-nonliteral
https://bugs.chromium.org/p/webm/issues/detail?id=1744#c3

The following revision refers to this bug:
https://chromium.googlesource.com/webm/libvpx/+/dd10ac8f69c1bc77fc69cd10de51092d07fbebb5

commit dd10ac8f69c1bc77fc69cd10de51092d07fbebb5
Author: James Zern <jz...@google.com>
Date: Wed Nov 03 00:19:10 2021

tools_common.h: add VPX_TOOLS_FORMAT_PRINTF

and use it to set the format attribute for printf like functions. this
allows the examples to be built with -Wformat-nonliteral without
producing warnings.

Bug: webm:1744
Change-Id: I26b4c41c9a42790053b1ae0e4a678af8f2cd1d82
Fixed: webm:1744

[modify] https://crrev.com/dd10ac8f69c1bc77fc69cd10de51092d07fbebb5/examples/vp8_multi_resolution_encoder.c
[modify] https://crrev.com/dd10ac8f69c1bc77fc69cd10de51092d07fbebb5/vpxstats.c
[modify] https://crrev.com/dd10ac8f69c1bc77fc69cd10de51092d07fbebb5/examples/svc_encodeframe.c
[modify] https://crrev.com/dd10ac8f69c1bc77fc69cd10de51092d07fbebb5/tools_common.h
[modify] https://crrev.com/dd10ac8f69c1bc77fc69cd10de51092d07fbebb5/examples/twopass_encoder.c
[modify] https://crrev.com/dd10ac8f69c1bc77fc69cd10de51092d07fbebb5/configure
[modify] https://crrev.com/dd10ac8f69c1bc77fc69cd10de51092d07fbebb5/rate_hist.c
[modify] https://crrev.com/dd10ac8f69c1bc77fc69cd10de51092d07fbebb5/warnings.c
[modify] https://crrev.com/dd10ac8f69c1bc77fc69cd10de51092d07fbebb5/vpxenc.c
[modify] https://crrev.com/dd10ac8f69c1bc77fc69cd10de51092d07fbebb5/examples/vpx_temporal_svc_encoder.c

Git Watcher via monorail

unread,
Nov 4, 2021, 3:21:08 PM11/4/21
to webm-d...@webmproject.org

Comment #4 on issue 1744 by Git Watcher: libvpx should compile with -Wformat-nonliteral
https://bugs.chromium.org/p/webm/issues/detail?id=1744#c4


The following revision refers to this bug:
https://chromium.googlesource.com/webm/libvpx/+/340f60524ffa35c7324c54fe404d84cc1a1ac402

commit 340f60524ffa35c7324c54fe404d84cc1a1ac402
Author: James Zern <jz...@google.com>
Date: Tue Nov 02 23:29:52 2021

vpx_codec_internal.h: add LIBVPX_FORMAT_PRINTF

and use it to set the format attribute for the printf like function
vpx_internal_error(). this allows the main library to be built with
-Wformat-nonliteral without producing warnings; the examples will be
handled in a followup.

Bug: webm:1744
Change-Id: Iebc322e24db35d902c5a2b1ed767d2e10e9c91b9

[modify] https://crrev.com/340f60524ffa35c7324c54fe404d84cc1a1ac402/vpx/internal/vpx_codec_internal.h

Git Watcher via monorail

unread,
Nov 4, 2021, 9:17:08 PM11/4/21
to webm-d...@webmproject.org

Comment #5 on issue 1744 by Git Watcher: libvpx should compile with -Wformat-nonliteral
https://bugs.chromium.org/p/webm/issues/detail?id=1744#c5


The following revision refers to this bug:
https://aomedia.googlesource.com/aom/+/20660e5e557abce681bdfb63431e42529bba8ad6

commit 20660e5e557abce681bdfb63431e42529bba8ad6
Author: James Zern <jz...@google.com>

Date: Wed Nov 03 00:19:10 2021

tools_common.h: add AOM_TOOLS_FORMAT_PRINTF


and use it to set the format attribute for printf like functions. this
allows the examples to be built with -Wformat-nonliteral without
producing warnings.

this is the same change that was applied in libvpx:
dd10ac8f6 tools_common.h: add VPX_TOOLS_FORMAT_PRINTF


Bug: webm:1744
Change-Id: I26b4c41c9a42790053b1ae0e4a678af8f2cd1d82

[modify] https://crrev.com/20660e5e557abce681bdfb63431e42529bba8ad6/common/args.c
[modify] https://crrev.com/20660e5e557abce681bdfb63431e42529bba8ad6/stats/aomstats.c
[modify] https://crrev.com/20660e5e557abce681bdfb63431e42529bba8ad6/common/tools_common.h
[modify] https://crrev.com/20660e5e557abce681bdfb63431e42529bba8ad6/examples/noise_model.c
[modify] https://crrev.com/20660e5e557abce681bdfb63431e42529bba8ad6/examples/twopass_encoder.c
[modify] https://crrev.com/20660e5e557abce681bdfb63431e42529bba8ad6/stats/rate_hist.c
[modify] https://crrev.com/20660e5e557abce681bdfb63431e42529bba8ad6/build/cmake/aom_configure.cmake
[modify] https://crrev.com/20660e5e557abce681bdfb63431e42529bba8ad6/common/warnings.c
[modify] https://crrev.com/20660e5e557abce681bdfb63431e42529bba8ad6/examples/svc_encoder_rtc.c
[modify] https://crrev.com/20660e5e557abce681bdfb63431e42529bba8ad6/apps/aomenc.c

Git Watcher via monorail

unread,
Nov 4, 2021, 9:17:10 PM11/4/21
to webm-d...@webmproject.org

Comment #6 on issue 1744 by Git Watcher: libvpx should compile with -Wformat-nonliteral
https://bugs.chromium.org/p/webm/issues/detail?id=1744#c6


The following revision refers to this bug:
https://aomedia.googlesource.com/aom/+/4c3263bd659622cf99860901d194d533621f9220

commit 4c3263bd659622cf99860901d194d533621f9220
Author: James Zern <jz...@google.com>

Date: Tue Nov 02 23:29:52 2021

aom_codec_internal.h: add LIBAOM_FORMAT_PRINTF

and use it to set the format attribute for the printf like function
aom_internal_error(). this allows the main library to be built with

-Wformat-nonliteral without producing warnings; the examples will be
handled in a followup.

this is the same change that was applied in libvpx:
340f60524 vpx_codec_internal.h: add LIBVPX_FORMAT_PRINTF


Bug: webm:1744
Change-Id: Iebc322e24db35d902c5a2b1ed767d2e10e9c91b9

Reply all
Reply to author
Forward
0 new messages