Skip to content

Commit

Permalink
Merge pull request #471 from libtom/prevent-overflow
Browse files Browse the repository at this point in the history
Prevent overflow
  • Loading branch information
sjaeckel committed Jan 7, 2020
2 parents 6ac0b0c + ca6924b commit ffd8066
Show file tree
Hide file tree
Showing 14 changed files with 163 additions and 439 deletions.
2 changes: 1 addition & 1 deletion demo/shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ void print_header(void)
printf("Size of mp_digit: %u\n", (unsigned int)sizeof(mp_digit));
printf("Size of mp_word: %u\n", (unsigned int)sizeof(mp_word));
printf("MP_DIGIT_BIT: %d\n", MP_DIGIT_BIT);
printf("MP_PREC: %d\n", MP_PREC);
printf("MP_DEFAULT_DIGIT_COUNT: %d\n", MP_DEFAULT_DIGIT_COUNT);
}
4 changes: 2 additions & 2 deletions demo/shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
#include "tommath_private.h"


#define EXPECT(a) do { if (!(a)) { fprintf(stderr, "%d: EXPECT(%s) failed\n", __LINE__, #a); goto LBL_ERR; } } while(0)
#define DO_WHAT(a, what) do { mp_err err; if ((err = (a)) != MP_OKAY) { fprintf(stderr, "%d: DO(%s) failed: %s\n", __LINE__, #a, mp_error_to_string(err)); what; } } while(0)
#define EXPECT(a) do { if (!(a)) { fprintf(stderr, "%s, line %d: EXPECT(%s) failed\n", __func__, __LINE__, #a); goto LBL_ERR; } } while(0)
#define DO_WHAT(a, what) do { mp_err err; if ((err = (a)) != MP_OKAY) { fprintf(stderr, "%s, line %d: DO(%s) failed: %s\n", __func__, __LINE__, #a, mp_error_to_string(err)); what; } } while(0)
#define DO(a) DO_WHAT(a, goto LBL_ERR)
#define DOR(a) DO_WHAT(a, return EXIT_FAILURE)

Expand Down
Loading

0 comments on commit ffd8066

Please sign in to comment.