Tíquete #45917

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

: 2022-10-18 17:37 Última Atualização: 2023-04-09 18:00

Relator:
Dono:
Tipo:
Estado:
Fechado
Componente:
Marcos:
Prioridade:
5 - Medium
Gravidade:
5 - Medium
Resolução:
Fixed
Arquivo:
2

Details

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
  • Dono Update from (Nenhum) to cazfi
  • Resolução Update from Nenhum to Accepted
2023-03-25 12:43 Updated by: cazfi
Comentário

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
Comentário

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
Comentário

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

2023-04-09 18:00 Updated by: cazfi
  • Estado Update from Aberto to Fechado
  • Resolução Update from Accepted to Fixed

Attachment File List

Editar

Please login to add comment to this ticket » Login