w00t-labs / libtorrent

Automatically exported from code.google.com/p/libtorrent
Other
0 stars 0 forks source link

Array boundary exceeding in stats_alert::message() with TORRENT_DISABLE_FULL_STATS define #734

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Array boundary exceeding in stats_alert::message() with 
TORRENT_DISABLE_FULL_STATS define

What steps will reproduce the problem?
  Build libtorrent with TORRENT_DISABLE_FULL_STATS

What version of the product are you using? On what operating system?
  libtorrent-rasterbar-1.0.4
  MS VS 2013 update 4
  (Win 8.1 64)

Please provide any additional information below.
  'libtorrent/src/alert.cpp'
    std::string stats_alert::message() const
      snprintf(msg, sizeof(msg), "%s: [%d] %d %d %d %d %d %d %d %d %d %d"
        ...
      , transferred[0]
        ...
      , transferred[9]);

  Access to 10 elements of the array
  But array size depends on TORRENT_DISABLE_FULL_STATS define

  'include/libtorrent/alert_types.hpp'
    enum stats_channel
    {
        ...
    #ifndef TORRENT_DISABLE_FULL_STATS
        ...
    #endif
      num_channels
    };
    int transferred[num_channels];

    With TORRENT_DISABLE_FULL_STATS: num_channels = 5

Original issue reported on code.google.com by rominmai...@gmail.com on 9 Apr 2015 at 10:18

GoogleCodeExporter commented 8 years ago
thanks! fixed in RC_1_0 in [10959].

Original comment by arvid.no...@gmail.com on 11 Apr 2015 at 12:21