Incidencia #45917

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

Abrir Fecha: 2022-10-18 17:37 Última actualización: 2023-04-09 18:00

Informador:
Propietario:
Tipo:
Estado:
Cerrado
Componente:
Prioridad:
5 - Medium
Gravedad:
5 - Medium
Resolución:
Fixed
Fichero:
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
  • Propietario Update from (Ninguno) to cazfi
  • Resolución Update from Ninguno to Accepted
2023-03-25 12:43 Updated by: cazfi
Comentario

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
Comentario

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
Comentario

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 Open to Cerrado
  • Resolución Update from Accepted to Fixed

Attachment File List

Editar

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