You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This program fails as the my_key TLS key is corrupted (overwritten with NULL).
#include<pthread.h>#include"s2n_test.h"staticintmy_global;
staticvoidmy_destructor(void*arg) {}
/* Checks that calling s2n_cleanup without s2n_init does not corrupt * thread-local storage. */intmain(intargc, char**argv)
{
BEGIN_TEST_NO_INIT();
pthread_key_tmy_key;
/* Init the pthread key */EXPECT_SUCCESS(pthread_key_create(&my_key, my_destructor));
/* Set it a value */EXPECT_SUCCESS(pthread_setspecific(my_key, &my_global));
/* Call s2n_cleanup with no init */EXPECT_SUCCESS(s2n_cleanup());
/* Check that the key is not corrupted */int*new_value= (int*) pthread_getspecific(my_key);
EXPECT_EQUAL(new_value, &my_global);
/* Delete the key */EXPECT_SUCCESS(pthread_key_delete(my_key));
END_TEST_NO_INIT();
}
Solution:
This should work, or at least crash in a safe way without corruption.
The text was updated successfully, but these errors were encountered:
Problem:
This is a regression caused by the fix in #4024
This program fails as the
my_key
TLS key is corrupted (overwritten withNULL
).Solution:
This should work, or at least crash in a safe way without corruption.
The text was updated successfully, but these errors were encountered: