Opened 3 years ago

Closed 3 years ago

#8012 closed defect (invalid)

Compilation warnings for GCC 9.1

Reported by: Artem S. Tashkinov Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

1.
./libavutil/mem.h:342:1: warning: ‘alloc_size’ attribute ignored on a function returning ‘int’ [-Wattributes]
  342 | av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
      | ^~~~~~~~~~~~~

2.
libavdevice/v4l2.c: In function ‘v4l2_get_device_list’:
libavdevice/v4l2.c:1050:58: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 251 [-Wformat-truncation=]
 1050 |         snprintf(device_name, sizeof(device_name), "/dev/%s", entry->d_name);
      |                                                          ^~
libavdevice/v4l2.c:1050:9: note: ‘snprintf’ output between 6 and 261 bytes into a destination of size 256
 1050 |         snprintf(device_name, sizeof(device_name), "/dev/%s", entry->d_name);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

3.
libavformat/img2enc.c: In function ‘write_packet’:
libavformat/img2enc.c:118:59: warning: ‘.tmp’ directive output may be truncated writing 4 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
  118 |             snprintf(img->tmp[i], sizeof(img->tmp[i]), "%s.tmp", filename);
      |                                                           ^~~~
libavformat/img2enc.c:118:13: note: ‘snprintf’ output between 5 and 1028 bytes into a destination of size 1024
  118 |             snprintf(img->tmp[i], sizeof(img->tmp[i]), "%s.tmp", filename);
      | 

4.
libavformat/ftp.c: In function ‘ftp_move’:
libavformat/ftp.c:1097:46: warning: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size 4091 [-Wformat-truncation=]
 1097 |     snprintf(command, sizeof(command), "RNTO %s\r\n", path);
      |                                              ^~       ~~~~
libavformat/ftp.c:1097:5: note: ‘snprintf’ output between 8 and 4103 bytes into a destination of size 4096
 1097 |     snprintf(command, sizeof(command), "RNTO %s\r\n", path);
      | 

5.
libavformat/dashenc.c: In function ‘flush_init_segment’:
libavformat/dashenc.c:360:49: warning: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
  360 |         snprintf(filename, sizeof(filename), "%s%s", c->dirname, os->initfile);
      |                                                 ^~
libavformat/dashenc.c:360:9: note: ‘snprintf’ output between 1 and 2047 bytes into a destination of size 1024
  360 |         snprintf(filename, sizeof(filename), "%s%s", c->dirname, os->initfile);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavformat/dashenc.c: In function ‘dash_init’:
libavformat/dashenc.c:690:49: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
  690 |             snprintf(as->id, sizeof(as->id), "%d", i);
      |                                                 ^
libavformat/dashenc.c:690:13: note: ‘snprintf’ output between 2 and 11 bytes into a destination of size 10
  690 |             snprintf(as->id, sizeof(as->id), "%d", i);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavformat/dashenc.c:1056:65: warning: ‘-stream’ directive output may be truncated writing 7 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
 1056 |                 snprintf(os->initfile, sizeof(os->initfile), "%s-stream%d.m4s", basename, i);
      |                                                                 ^~~~~~~
libavformat/dashenc.c:1056:62: note: directive argument in the range [0, 2147483647]
 1056 |                 snprintf(os->initfile, sizeof(os->initfile), "%s-stream%d.m4s", basename, i);
      |                                                              ^~~~~~~~~~~~~~~~~
libavformat/dashenc.c:1056:17: note: ‘snprintf’ output between 13 and 1045 bytes into a destination of size 1024
 1056 |                 snprintf(os->initfile, sizeof(os->initfile), "%s-stream%d.m4s", basename, i);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavformat/dashenc.c:1060:49: warning: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
 1060 |         snprintf(filename, sizeof(filename), "%s%s", c->dirname, os->initfile);
      |                                                 ^~
libavformat/dashenc.c:1060:9: note: ‘snprintf’ output between 1 and 2047 bytes into a destination of size 1024
 1060 |         snprintf(filename, sizeof(filename), "%s%s", c->dirname, os->initfile);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavformat/dashenc.c: In function ‘dash_flush’:
libavformat/dashenc.c:1313:63: warning: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
 1313 |             snprintf(os->full_path, sizeof(os->full_path), "%s%s", c->dirname, os->initfile);
      |                                                               ^~
libavformat/dashenc.c:1313:13: note: ‘snprintf’ output between 1 and 2047 bytes into a destination of size 1024
 1313 |             snprintf(os->full_path, sizeof(os->full_path), "%s%s", c->dirname, os->initfile);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavformat/dashenc.c:1364:61: warning: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
 1364 |                     snprintf(filename, sizeof(filename), "%s%s", c->dirname, os->segments[j]->file);
      |                                                             ^~
libavformat/dashenc.c:1364:21: note: ‘snprintf’ output between 1 and 2047 bytes into a destination of size 1024
 1364 |                     snprintf(filename, sizeof(filename), "%s%s", c->dirname, os->segments[j]->file);
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavformat/dashenc.c:343:49: warning: ‘media_’ directive output may be truncated writing 6 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
  343 |         snprintf(playlist_name, string_size, "%smedia_%d.m3u8", base_url, id);
      |                                                 ^~~~~~
libavformat/dashenc.c:343:46: note: directive argument in the range [0, 2147483647]
  343 |         snprintf(playlist_name, string_size, "%smedia_%d.m3u8", base_url, id);
      |                                              ^~~~~~~~~~~~~~~~~
libavformat/dashenc.c:343:9: note: ‘snprintf’ output between 13 and 1045 bytes into a destination of size 1024
  343 |         snprintf(playlist_name, string_size, "%smedia_%d.m3u8", base_url, id);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavformat/dashenc.c:343:49: warning: ‘media_’ directive output may be truncated writing 6 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
  343 |         snprintf(playlist_name, string_size, "%smedia_%d.m3u8", base_url, id);
      |                                                 ^~~~~~
libavformat/dashenc.c:343:46: note: directive argument in the range [0, 2147483647]
  343 |         snprintf(playlist_name, string_size, "%smedia_%d.m3u8", base_url, id);
      |                                              ^~~~~~~~~~~~~~~~~
libavformat/dashenc.c:343:9: note: ‘snprintf’ output between 13 and 1045 bytes into a destination of size 1024
  343 |         snprintf(playlist_name, string_size, "%smedia_%d.m3u8", base_url, id);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavformat/dashenc.c:877:61: warning: ‘master.m3u8’ directive output may be truncated writing 11 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
  877 |             snprintf(filename_hls, sizeof(filename_hls), "%smaster.m3u8", c->dirname);
      |                                                             ^~~~~~~~~~~
libavformat/dashenc.c:877:13: note: ‘snprintf’ output between 12 and 1035 bytes into a destination of size 1024
  877 |             snprintf(filename_hls, sizeof(filename_hls), "%smaster.m3u8", c->dirname);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavformat/dashenc.c: In function ‘dash_write_trailer’:
libavformat/dashenc.c:1538:53: warning: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
 1538 |             snprintf(filename, sizeof(filename), "%s%s", c->dirname, os->initfile);
      |                                                     ^~
libavformat/dashenc.c:1538:13: note: ‘snprintf’ output between 1 and 2047 bytes into a destination of size 1024
 1538 |             snprintf(filename, sizeof(filename), "%s%s", c->dirname, os->initfile);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavformat/dashenc.c: In function ‘dash_write_packet’:
libavformat/dashenc.c:1488:59: warning: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
 1488 |         snprintf(os->full_path, sizeof(os->full_path), "%s%s", c->dirname,
      |                                                           ^~
libavformat/dashenc.c:1488:9: note: ‘snprintf’ output between 1 and 2047 bytes into a destination of size 1024
 1488 |         snprintf(os->full_path, sizeof(os->full_path), "%s%s", c->dirname,
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1489 |                  os->filename);
      |                  ~~~~~~~~~~~~~
libavformat/dashenc.c:1488:59: warning: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
 1488 |         snprintf(os->full_path, sizeof(os->full_path), "%s%s", c->dirname,
      |                                                           ^~
libavformat/dashenc.c:1488:9: note: ‘snprintf’ output between 1 and 2047 bytes into a destination of size 1024
 1488 |         snprintf(os->full_path, sizeof(os->full_path), "%s%s", c->dirname,
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1489 |                  os->filename);
      |  

6.
libavformat/rtsp.c: In function ‘rtp_read_header’:
libavformat/rtsp.c:2500:32: warning: ‘%s’ directive output may be truncated writing up to 499 bytes into a region of size 486 [-Wformat-truncation=]
 2500 |              "v=0\r\nc=IN IP%d %s\r\nm=%s %d RTP/AVP %d\r\n",
      |                                ^~
 2501 |              addr.ss_family == AF_INET ? 4 : 6, host,
      |                                                 ~~~~
libavformat/rtsp.c:2500:14: note: directive argument in the range [0, 127]
 2500 |              "v=0\r\nc=IN IP%d %s\r\nm=%s %d RTP/AVP %d\r\n",
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavformat/rtsp.c:2499:5: note: ‘snprintf’ output between 38 and 555 bytes into a destination of size 500
 2499 |     snprintf(sdp, sizeof(sdp),
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~
 2500 |              "v=0\r\nc=IN IP%d %s\r\nm=%s %d RTP/AVP %d\r\n",
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2501 |              addr.ss_family == AF_INET ? 4 : 6, host,
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2502 |              par->codec_type == AVMEDIA_TYPE_DATA  ? "application" :
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2503 |              par->codec_type == AVMEDIA_TYPE_VIDEO ? "video" : "audio",
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2504 |              port, payload_type);
      |              ~~~~~~~~~~~~~~~~~~~
libavformat/rtsp.c: In function ‘ff_rtsp_make_setup_request’:
libavformat/rtsp.c:1541:30: warning: ‘%s’ directive output may be truncated writing up to 2047 bytes into a region of size 2037 [-Wformat-truncation=]
 1541 |                  "Transport: %s\r\n",
      |                              ^~
 1542 |                  transport);
      |                  ~~~~~~~~~    
libavformat/rtsp.c:1540:9: note: ‘snprintf’ output between 14 and 2061 bytes into a destination of size 2048
 1540 |         snprintf(cmd, sizeof(cmd),
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
 1541 |                  "Transport: %s\r\n",
      |                  ~~~~~~~~~~~~~~~~~~~~
 1542 |                  transport);
      |                  ~~~~~~~~~~

7. 
libavformat/smoothstreamingenc.c: In function ‘ism_flush’:
libavformat/smoothstreamingenc.c:528:49: warning: ‘/temp’ directive output may be truncated writing 5 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
  528 |         snprintf(filename, sizeof(filename), "%s/temp", os->dirname);
      |                                                 ^~~~~
libavformat/smoothstreamingenc.c:528:9: note: ‘snprintf’ output between 6 and 1029 bytes into a destination of size 1024
  528 |         snprintf(filename, sizeof(filename), "%s/temp", os->dirname);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavformat/smoothstreamingenc.c:544:63: warning: ‘/FragmentInfo(’ directive output may be truncated writing 14 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
  544 |         snprintf(header_filename, sizeof(header_filename), "%s/FragmentInfo(%s=%"PRIu64")", os->dirname, os->stream_type_tag, start_ts);
      |                                                               ^~~~~~~~~~~~~~
libavformat/smoothstreamingenc.c:544:9: note: ‘snprintf’ output 18 or more bytes (assuming 1041) into a destination of size 1024
  544 |         snprintf(header_filename, sizeof(header_filename), "%s/FragmentInfo(%s=%"PRIu64")", os->dirname, os->stream_type_tag, start_ts);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavformat/smoothstreamingenc.c:545:63: warning: ‘/Fragments(’ directive output may be truncated writing 11 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
  545 |         snprintf(target_filename, sizeof(target_filename), "%s/Fragments(%s=%"PRIu64")", os->dirname, os->stream_type_tag, start_ts);
      |                                                               ^~~~~~~~~~~
libavformat/smoothstreamingenc.c:545:9: note: ‘snprintf’ output 15 or more bytes (assuming 1038) into a destination of size 1024
  545 |         snprintf(target_filename, sizeof(target_filename), "%s/Fragments(%s=%"PRIu64")", os->dirname, os->stream_type_tag, start_ts);
      | 

8.
libavcodec/alac.c: In function ‘allocate_buffers’:
./libavutil/internal.h:142:9: warning: argument 1 value ‘18446744073709551552’ exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
  142 |     p = av_malloc(size);\
      |         ^~~~~~~~~~~~~~~
libavcodec/alac.c:498:9: note: in expansion of macro ‘FF_ALLOC_OR_GOTO’
  498 |         FF_ALLOC_OR_GOTO(alac->avctx, alac->predict_error_buffer[ch],
      |         ^~~~~~~~~~~~~~~~
In file included from ./libavutil/common.h:488,
                 from ./libavutil/avutil.h:296,
                 from ./libavutil/opt.h:31,
                 from libavcodec/alac.c:51:
./libavutil/mem.h:196:7: note: in a call to allocation function ‘av_malloc’ declared here
  196 | void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1);
      |       ^~~~~~~~~


9.
libavcodec/avrndec.c: In function ‘init’:
libavcodec/avrndec.c:59:9: warning: ‘refcounted_frames’ is deprecated [-Wdeprecated-declarations]
   59 |         a->mjpeg_avctx->refcounted_frames = 1;
      |         ^
In file included from libavcodec/avrndec.c:22:
libavcodec/avcodec.h:2360:9: note: declared here
 2360 |     int refcounted_frames;
      |         ^~~~~~~~~~~~~~~~~
libavcodec/avrndec.c: In function ‘decode_frame’:
libavcodec/avrndec.c:110:9: warning: ‘avcodec_decode_video2’ is deprecated [-Wdeprecated-declarations]
  110 |         ret = avcodec_decode_video2(a->mjpeg_avctx, data, got_frame, avpkt);
      | 
In file included from libavcodec/avrndec.c:22:
libavcodec/avcodec.h:4771:5: note: declared here
 4771 | int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
      | 

Change History (1)

comment:1 by Carl Eugen Hoyos, 3 years ago

Resolution: invalid
Status: newclosed

I cannot reproduce / feel free to send patches to the appropriate mailing list(s).

Note: See TracTickets for help on using tickets.