~tdaitx/whoopsie/security-fixes

« back to all changes in this revision

Viewing changes to lib/bson/bson.h

  • Committer: Tiago Stürmer Daitx
  • Date: 2019-10-30 04:28:50 UTC
  • Revision ID: tiago.daitx@ubuntu.com-20191030042850-u1gymgv6u3gw59ll
SECURITY UPDATE: Integer overflow when handling large bson objects (LP: #1830865)

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
typedef struct {
87
87
    char *data;
88
88
    char *cur;
89
 
    int dataSize;
 
89
    size_t dataSize;
90
90
    bson_bool_t finished;
91
91
    int stack[32];
92
92
    int stackPos;
119
119
 *
120
120
 * @return the size.
121
121
 */
122
 
int bson_size( const bson *b );
 
122
size_t bson_size( const bson *b );
123
123
 
124
124
/**
125
125
 * Print a string representation of a BSON object.
546
546
 *
547
547
 * @return BSON_OK or BSON_ERROR.
548
548
 */
549
 
void bson_init_size( bson *b, int size );
 
549
void bson_init_size( bson *b, size_t size );
550
550
 
551
551
/**
552
552
 * Grow a bson object.
557
557
 * @return BSON_OK or BSON_ERROR with the bson error object set.
558
558
 *   Exits if allocation fails.
559
559
 */
560
 
int bson_ensure_space( bson *b, const int bytesNeeded );
 
560
int bson_ensure_space( bson *b, const size_t bytesNeeded );
561
561
 
562
562
/**
563
563
 * Finalize a bson object.
930
930
 *
931
931
 * @sa malloc(3)
932
932
 */
933
 
void *bson_malloc( int size );
 
933
void *bson_malloc( size_t size );
934
934
 
935
935
/**
936
936
 * Changes the size of allocated memory and checks return value,
943
943
 *
944
944
 * @sa realloc()
945
945
 */
946
 
void *bson_realloc( void *ptr, int size );
 
946
void *bson_realloc( void *ptr, size_t size );
947
947
 
948
948
/**
949
949
 * Set a function for error handling.