Ticket #45917

fc_rand(): 'do { ... } while (size > 1)' run once for size == 1

Date d'ouverture: 2022-10-18 17:37 Dernière mise à jour: 2023-04-09 18:00

Rapporteur:
Propriétaire:
Type:
État:
Atteints
Composant:
Priorité:
5 - moyen
Sévérité:
5 - moyen
Résolution:
Fixed
Fichier:
2

Détails

fc_rand() (actually fc_rand_debug() ) is not supposed to do any work for (size <= 1), as it even has a comment about initializing stuff for such size:

/*
* These assignments are only here to make the compiler
* happy. Since each usage is guarded with a if (size > 1).
*/

But the loop there is a "do ... while()" one, so it always execute once.

Ticket History (3/10 Histories)

2022-10-18 17:37 Updated by: cazfi
  • New Ticket "fc_rand(): 'do { ... } while (size > 1)' run once for size == 1" created
2022-12-05 00:20 Updated by: cazfi
2023-01-30 13:00 Updated by: cazfi
2023-03-25 12:35 Updated by: cazfi
  • Propriétaire Update from (Aucun) to cazfi
  • Résolution Update from Aucun to Accepted
2023-03-25 12:43 Updated by: cazfi
Commentaire

This means that fc_rand(1) (or fc_rand(0) ) no longer change the random state at all. While it's unlikely that anything has relied on the old behavior of any fc_rand() call to change random state, it's possible that this reveals some subtle bug.

2023-03-27 11:56 Updated by: cazfi
Commentaire

Reply To cazfi

it's possible that this reveals some subtle bug.

With risk like this, and issue being fixed being so minor -> not to 3.0.7 in the last minute.

2023-04-01 13:49 Updated by: cazfi
Commentaire

Pushed to branches other than S3_0. S3_0 waiting for 3.0.7 release.

2023-04-09 18:00 Updated by: cazfi
  • État Update from Ouvert to Atteints
  • Résolution Update from Accepted to Fixed

Attachment File List

Modifier

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Connexion