~jamesh/thumbnailer/landing-20150622

« back to all changes in this revision

Viewing changes to src/thumbnailcache.cpp

  • Committer: CI Train Bot
  • Author(s): Jussi Pakkanen
  • Date: 2015-01-06 18:50:35 UTC
  • mfrom: (114.1.2 thumbnailer)
  • Revision ID: ci_train_bot_citrain_user@canonical.com-20150106185035-3vl3mdrchpvrptwl
Fix a few potential memory corruptions. Fixes: #1403906
Approved by: James Henstridge

Show diffs side-by-side

added added

removed removed

Lines of Context:
237
237
    if(normalized) {
238
238
        buf = (const unsigned char*)normalized;
239
239
    }
240
 
    gssize bytes = str.length();
 
240
    gssize bytes = strlen((const char*)buf);
241
241
 
242
242
    result = g_compute_checksum_for_data(G_CHECKSUM_MD5, buf, bytes);
243
243
    final_result = result;
247
247
}
248
248
 
249
249
string ThumbnailCachePrivate::get_cache_file_name(const std::string & abs_original, ThumbnailSize desired) const {
 
250
    assert(!abs_original.empty());
250
251
    assert(abs_original[0] == '/');
251
252
    string path;
252
253
    switch(desired) {