Commit 9ab538e3 authored by Derek Buitenhuis's avatar Derek Buitenhuis Committed by Michael Niedermayer

random_seed: Replace a VLA with a normal array

Signed-off-by: 's avatarDerek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent b86e18fe
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <math.h> #include <math.h>
#include <time.h> #include <time.h>
#include <string.h> #include <string.h>
#include "avassert.h"
#include "timer.h" #include "timer.h"
#include "random_seed.h" #include "random_seed.h"
#include "sha.h" #include "sha.h"
...@@ -55,7 +56,7 @@ static int read_random(uint32_t *dst, const char *file) ...@@ -55,7 +56,7 @@ static int read_random(uint32_t *dst, const char *file)
static uint32_t get_generic_seed(void) static uint32_t get_generic_seed(void)
{ {
uint8_t tmp[av_sha_size]; uint8_t tmp[120];
struct AVSHA *sha = (void*)tmp; struct AVSHA *sha = (void*)tmp;
clock_t last_t = 0; clock_t last_t = 0;
static uint64_t i = 0; static uint64_t i = 0;
...@@ -63,6 +64,8 @@ static uint32_t get_generic_seed(void) ...@@ -63,6 +64,8 @@ static uint32_t get_generic_seed(void)
unsigned char digest[32]; unsigned char digest[32];
uint64_t last_i = i; uint64_t last_i = i;
av_assert0(sizeof(tmp) >= av_sha_size);
if(TEST){ if(TEST){
memset(buffer, 0, sizeof(buffer)); memset(buffer, 0, sizeof(buffer));
last_i = i = 0; last_i = i = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment