Changeset 597 for vendor/current/lib


Ignore:
Timestamp:
Jul 2, 2011, 4:01:14 PM (14 years ago)
Author:
Herwig Bauernfeind
Message:

Samba 3.5: Update vendor to version 3.5.9

Location:
vendor/current/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/lib/tdb/common/io.c

    r414 r597  
    300300{
    301301        struct tdb_record rec;
    302         tdb_off_t offset, new_size;     
     302        tdb_off_t offset, new_size, top_size, map_size;
    303303
    304304        if (tdb_lock(tdb, -1, F_WRLCK) == -1) {
     
    310310        tdb->methods->tdb_oob(tdb, tdb->map_size + 1, 1);
    311311
    312         /* always make room for at least 100 more records, and at
    313            least 25% more space. Round the database up to a multiple
    314            of the page size */
    315         new_size = MAX(tdb->map_size + size*100, tdb->map_size * 1.25);
     312        /* limit size in order to avoid using up huge amounts of memory for
     313         * in memory tdbs if an oddball huge record creeps in */
     314        if (size > 100 * 1024) {
     315                top_size = tdb->map_size + size * 2;
     316        } else {
     317                top_size = tdb->map_size + size * 100;
     318        }
     319
     320        /* always make room for at least top_size more records, and at
     321           least 25% more space. if the DB is smaller than 100MiB,
     322           otherwise grow it by 10% only. */
     323        if (tdb->map_size > 100 * 1024 * 1024) {
     324                map_size = tdb->map_size * 1.10;
     325        } else {
     326                map_size = tdb->map_size * 1.25;
     327        }
     328
     329        /* Round the database up to a multiple of the page size */
     330        new_size = MAX(top_size, map_size);
    316331        size = TDB_ALIGN(new_size, tdb->page_size) - tdb->map_size;
    317332
  • vendor/current/lib/util/asn1.c

    r414 r597  
    717717{
    718718        uint8_t b;
     719        bool first_byte = true;
    719720        *i = 0;
    720721
    721722        while (!data->has_error && asn1_tag_remaining(data)>0) {
    722723                if (!asn1_read_uint8(data, &b)) return false;
     724                if (first_byte) {
     725                        if (b & 0x80) {
     726                                /* Number is negative.
     727                                   Set i to -1 for sign extend. */
     728                                *i = -1;
     729                        }
     730                        first_byte = false;
     731                }
    723732                *i = (*i << 8) + b;
    724733        }
Note: See TracChangeset for help on using the changeset viewer.