Merge branch 'maint'
authorAndre Noll <maan@tuebingen.mpg.de>
Fri, 1 Apr 2016 23:33:47 +0000 (01:33 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Fri, 1 Apr 2016 23:33:47 +0000 (01:33 +0200)
A couple of overflow bugs and a aslignment issue, all detected by ubsan. Plus
two unrelated old bugs.

* maint:
  client: Fix lsatt completer.
  playlist: Do not update score if no playlist is open.
  Avoid member access within misaligned address for ancillary data buffer.
  mood.c: Avoid overflow in update_quadratic_deviation().
  mood.c: Avoid integer underflow.
  mood.c: Avoid integer overflow.

1  2 
afs.c
client.c
mood.c
net.c
playlist.c
vss.c

diff --cc afs.c
Simple merge
diff --cc client.c
Simple merge
diff --cc mood.c
--- 1/mood.c
--- 2/mood.c
+++ b/mood.c
@@@ -446,16 -472,34 +446,16 @@@ static int64_t normalized_value(int64_
  {
        if (!n || !qd)
                return 0;
-       return 100 * (n * x - sum) / (int64_t)int_sqrt(n * qd);
+       return 100 * (n * x - sum) / (int64_t)int_sqrt(n) / (int64_t)int_sqrt(qd);
  }
  
 -static long compute_num_played_score(struct afs_info *afsi)
 +static long compute_score(struct afs_info *afsi, long mood_score)
  {
 -      return -normalized_value(afsi->num_played, statistics.num,
 +      mood_score -= normalized_value(afsi->num_played, statistics.num,
                statistics.num_played_sum, statistics.num_played_qd);
 -}
 -
 -static long compute_last_played_score(struct afs_info *afsi)
 -{
 -      return -normalized_value(afsi->last_played, statistics.num,
 +      mood_score -= normalized_value(afsi->last_played, statistics.num,
                statistics.last_played_sum, statistics.last_played_qd);
 -}
 -
 -static long compute_dynamic_score(const struct osl_row *aft_row)
 -{
 -      struct afs_info afsi;
 -      int64_t score, nscore = 0, lscore = 0;
 -      int ret;
 -
 -      ret = get_afsi_of_row(aft_row, &afsi);
 -      if (ret < 0)
 -              return -100;
 -      nscore = compute_num_played_score(&afsi);
 -      lscore = compute_last_played_score(&afsi);
 -      score = nscore + lscore;
 -      return score;
 +      return mood_score / 3;
  }
  
  static int add_afs_statistics(const struct osl_row *row)
diff --cc net.c
Simple merge
diff --cc playlist.c
Simple merge
diff --cc vss.c
Simple merge