Skip to content

Commit

Permalink
Error if framesize is not power of two.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinmera committed Jan 12, 2025
1 parent 7f9d343 commit 0a3ec8c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/segments/fft.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,13 @@ int fft_segment_set(uint32_t field, void *value, struct mixed_segment *segment){
data->samplerate = *(uint32_t *)value;
break;
case MIXED_FRAMESIZE:
if(*(uint32_t *)value <= 0 || 1<<13 < *(uint32_t *)value){
{ uint32_t framesize = *(uint32_t *)value;
if(framesize <= 2 || 1<<13 < framesize || (framesize & (framesize - 1)) == 0){
mixed_err(MIXED_INVALID_VALUE);
return 0;
}
data->framesize = *(uint32_t *)value;
break;
data->framesize = framesize;
}break;
case MIXED_OVERSAMPLING:
if(*(uint32_t *)value <= 0){
mixed_err(MIXED_INVALID_VALUE);
Expand Down

0 comments on commit 0a3ec8c

Please sign in to comment.