Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 801925 - sys-firmware/edk2-ovmf-202105-r1[-binary]: decode.c:2033:41: error: argument 2 of type ‘const uint8_t *’ {aka ‘const unsigned char *’} declared as a pointer
Summary: sys-firmware/edk2-ovmf-202105-r1[-binary]: decode.c:2033:41: error: argument ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Matthias Maier
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: gcc-11 CVE-2019-14584
  Show dependency tree
 
Reported: 2021-07-12 18:59 UTC by Andrea Postiglione
Modified: 2021-09-20 19:16 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (edk2-ovmf-build.log,49.10 KB, text/x-log)
2021-07-12 18:59 UTC, Andrea Postiglione
Details
fix vla parameter warning (fix_vla_parameter_warning.patch,2.02 KB, patch)
2021-08-27 15:35 UTC, Andrea Postiglione
Details | Diff
new build.log (edk2-ovmf-build.log.gz,52.21 KB, application/gzip)
2021-08-27 15:40 UTC, Andrea Postiglione
Details
Patch to fix the stringop overflow (edk2-ovmf-202105-fix-stringop-overflow.diff,403 bytes, patch)
2021-08-27 18:11 UTC, Jaak Ristioja
Details | Diff
Patch to fix the stringop overflow (attempt #2) (edk2-ovmf-202105-fix-stringop-overflow.diff,1.45 KB, patch)
2021-09-07 20:12 UTC, Jaak Ristioja
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrea Postiglione 2021-07-12 18:59:54 UTC
Created attachment 723601 [details]
build.log

brotli/c/dec/decode.c:2033:41: error: argument 2 of type ‘const uint8_t *’ {aka ‘const unsigned char *’} declared as a pointer [-Werror=vla-parameter]
 2033 |     size_t encoded_size, const uint8_t* encoded_buffer, size_t* decoded_size,
      |                          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
In file included from brotli/c/dec/decode.c:7:
./brotli/c/include/brotli/decode.h:204:19: note: previously declared as a variable length array ‘const uint8_t[*decoded_size]’ {aka ‘const unsigned char[*decoded_size]’}
  204 |     const uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(encoded_size)],
      |     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
brotli/c/dec/decode.c:2034:14: error: argument 4 of type ‘uint8_t *’ {aka ‘unsigned char *’} declared as a pointer [-Werror=vla-parameter]
 2034 |     uint8_t* decoded_buffer) {
      |     ~~~~~~~~~^~~~~~~~~~~~~~
Comment 1 Andrea Postiglione 2021-07-12 19:00:40 UTC
thunderdome ~ # emerge --info edk2-ovmf
Portage 3.0.20 (python 3.8.11-final-0, default/linux/amd64/17.1/desktop/plasma, gcc-11.1.0, glibc-2.33-r1, 5.13.1-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-5.13.1-gentoo-x86_64-Intel-R-_Core-TM-_i9-10900K_CPU_@_3.70GHz-with-glibc2.2.5
KiB Mem:    65755496 total,  57842180 free
KiB Swap:    8388604 total,   8388604 free
Timestamp of repository 4nykey: Mon, 12 Jul 2021 15:08:46 +0000
Head commit of repository 4nykey: fa0697f7025fcfa5a00174684be4d38905d14e2b

Timestamp of repository guru: Mon, 12 Jul 2021 15:08:47 +0000
Head commit of repository guru: 33309f0728028969de600e2ba4460d09fa9e5704

Timestamp of repository gentoo: Mon, 12 Jul 2021 17:15:01 +0000
Head commit of repository gentoo: 10dff37dc4031611daf37817c6ab4c9e1950493f
sh bash 5.1_p8
ld GNU ld (Gentoo 2.36.1 p3) 2.36.1
app-shells/bash:          5.1_p8::gentoo
dev-java/java-config:     2.3.1::gentoo
dev-lang/perl:            5.34.0::gentoo
dev-lang/python:          2.7.18_p10::gentoo, 3.8.11::gentoo
dev-lang/rust:            1.53.0::gentoo
dev-util/cmake:           3.20.5::gentoo
sys-apps/baselayout:      2.7-r3::gentoo
sys-apps/openrc:          0.43.3::gentoo
sys-apps/sandbox:         2.24::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.11.6-r3::gentoo, 1.13.4-r2::gentoo, 1.15.1-r2::gentoo, 1.16.3-r1::gentoo
sys-devel/binutils:       2.36.1-r1::gentoo
sys-devel/gcc:            11.1.0-r2::gentoo
sys-devel/gcc-config:     2.4::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.13::gentoo (virtual/os-headers)
sys-libs/glibc:           2.33-r1::gentoo
Repositories:

4nykey
    location: /var/db/repos/4nykey
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/4nykey.git
    masters: gentoo

guru
    location: /var/db/repos/guru
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/guru.git
    masters: gentoo

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync3.uk.gentoo.org/gentoo-portage/
    priority: 10
    sync-rsync-verify-max-age: 24
    sync-rsync-extra-opts: 
    sync-rsync-verify-metamanifest: no
    sync-rsync-verify-jobs: 1

local
    location: /var/db/repos/local
    masters: gentoo
    priority: 100

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -mtune=native -O3 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php8.0/ext-active/ /etc/php/cgi-php8.0/ext-active/ /etc/php/cli-php8.0/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -mtune=native -O3 -pipe"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-march=native -mtune=native -O3 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync metadata-transfer multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersync xattr"
FFLAGS="-march=native -mtune=native -O3 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org/"
LANG="it_IT.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j20"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac acl acpi activities alsa amd64 bluetooth branding bzip2 cairo cdda cdr cli crypt cups dbus declarative dri dts dvd dvdr elogind emboss encode exif flac fortran gdbm gif gpm gtk gui iconv icu ipv6 jpeg kde kipi kwallet lcms libglvnd libnotify libtirpc mad mng mp3 mp4 mpeg multilib ncurses nls nptl ogg opengl openmp pam pango pcre pdf phonon plasma png policykit ppds qml qt5 readline sdl seccomp semantic-desktop spell split-usr ssl startup-notification svg tcpd tiff truetype udev udisks unicode upower usb vorbis widgets wxwidgets x264 xattr xcb xml xv xvid zlib" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="libinput evdev mouse synaptics" KERNEL="linux" L10N="it" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-4" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-3 php7-4" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_8" PYTHON_TARGETS="python3_8" QEMU_SOFTMMU_TARGETS="x86_64 hppa i386" RUBY_TARGETS="ruby27" SANE_BACKENDS="xerox_mfp" USERLAND="GNU" VIDEO_CARDS="nouveau" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RUSTFLAGS

=================================================================
                        Package Settings
=================================================================

sys-firmware/edk2-ovmf-202008::gentoo was built with the following:
USE="-binary" ABI_X86="(64)"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync metadata-transfer multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"

thunderdome ~
Comment 2 lekto 2021-07-31 11:42:30 UTC
Same here: I was unable to build this using gcc-11.2, but was able to build using gcc-10.3
Comment 3 Jaak Ristioja 2021-08-11 20:37:08 UTC
Patching the embedded brotli sources with the following commit seems to work around this specific issue:

  https://github.com/google/brotli/commit/0a3944c8c99b8d10cc4325f721b7c273d2b41f7b

However, more compile errors seem to follow:

/var/tmp/portage/sys-firmware/edk2-ovmf-202105-r1/work/edk2-edk2-stable202105/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c:267:13: error: 'UsbHcBulkTransfer' accessing 80 bytes in a region of size 8 [-Werror=stringop-overflow=]
Comment 4 Andrea Postiglione 2021-08-27 15:35:59 UTC
Created attachment 736258 [details, diff]
fix vla parameter warning
Comment 5 Andrea Postiglione 2021-08-27 15:37:35 UTC
i used the patch attached but there is another error
Comment 6 Andrea Postiglione 2021-08-27 15:40:08 UTC
Created attachment 736261 [details]
new build.log

new build.log
Comment 7 Jaak Ristioja 2021-08-27 18:11:33 UTC
Created attachment 736294 [details, diff]
Patch to fix the stringop overflow

I hope this patch is a correct fix to the latter build error. I also filed an upstream pull request to get a review:

  https://github.com/tianocore/edk2/pull/1923
Comment 8 Andrea Postiglione 2021-08-27 18:21:07 UTC
now with your patch build correctly. Thanks!
Comment 9 John Helmert III gentoo-dev Security 2021-08-28 13:20:33 UTC
This bug still affects Gentoo's edk2-ovmf, right?
Comment 10 Andrea Postiglione 2021-08-28 14:49:29 UTC
(In reply to John Helmert III from comment #9)
> This bug still affects Gentoo's edk2-ovmf, right?

yes
Comment 11 Andrea Postiglione 2021-08-28 14:50:56 UTC
no sorry this bug is resolved!
Comment 12 John Helmert III gentoo-dev Security 2021-08-29 02:56:33 UTC
(In reply to Andrea Postiglione from comment #11)
> no sorry this bug is resolved!

I can still reproduce. Not sure what could've fixed this bug either, the package hasn't been touched since June.
Comment 13 Jaak Ristioja 2021-09-07 20:12:55 UTC
Created attachment 738076 [details, diff]
Patch to fix the stringop overflow (attempt #2)

Here's an updated patch. My previous patch caused fixed the compile, but likely introduced an even nastier bug. See https://github.com/tianocore/edk2/pull/1923 for details.
Comment 14 Pablo Cholaky 2021-09-07 22:03:15 UTC
I can also confirm both patches works well to me.

Thank you Jaak and Andre a for both patches.
Comment 15 Larry the Git Cow gentoo-dev 2021-09-08 19:31:53 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9c3662f5ee8b460227b2e5fc1ec46aa88f03e982

commit 9c3662f5ee8b460227b2e5fc1ec46aa88f03e982
Author:     John Helmert III <ajak@gentoo.org>
AuthorDate: 2021-08-29 05:12:27 +0000
Commit:     John Helmert III <ajak@gentoo.org>
CommitDate: 2021-09-08 19:31:07 +0000

    sys-firmware/edk2-ovmf: don't build with -Werror, python bump
    
    Closes: https://bugs.gentoo.org/801925
    Acked-By: Matthias Maier <tamiko@gentoo.org>
    Signed-off-by: John Helmert III <ajak@gentoo.org>

 sys-firmware/edk2-ovmf/edk2-ovmf-202105-r1.ebuild  |  3 +-
 .../edk2-ovmf/files/edk2-ovmf-202105-werror.patch  | 38 ++++++++++++++++++++++
 2 files changed, 40 insertions(+), 1 deletion(-)