A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/stlink-org/stlink/pull/1175 below:

Build broken on 32 bit systems · Issue #1175 · stlink-org/stlink · GitHub

The build of 1.7.0 on armv7 FreeBSD 13.0-RELEASE still fails as reported in bug #629. The issue reported there was never actually fixed. This concerns this line of code:

/wrkdirs/usr/ports/devel/stlink/work/stlink-1.7.0/src/common.c:2222:16: error: implicit conversion loses integer precision: 'off_t' (aka 'long long') to 'size_t' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
  mf->len = st.st_size;
          ~ ~~~^~~~~~~
1 error generated.

The problem is that while files are allowed to be very large, there is only a 32 bit address space on 32 bit machines. So size_t (for sizes of objects) is a 32 bit type while off_t (for sizes of files) is a 64 bit type. The correct resolution of this issue is to check if st.st_size is larger than SIZE_MAX (the largest possible size_t). If it is, an error must be returned immediately as the file is too large to be mapped. If st.st_size <= SIZE_MAX, a cast to size_t will not change the value and is thus correct to perform.

Please consider applying such a patch for 1.7.1.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4