1. 16 Apr, 2018 1 commit
    • Tom Anderson's avatar
      Fix undefined-shift UBSAN errors · c60ed9ef
      Tom Anderson authored
      The expression "1 << 31" will cause UBSAN to complain with this error message:
      runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
      
      The same operation on unsigned types is fine, however.  This CL replaces the
      strings "1 <<" with "1U <<".
      c60ed9ef
  2. 02 Aug, 2017 1 commit
  3. 09 Jun, 2017 1 commit
    • Florent Rougon's avatar
      fc-lang: gracefully handle the case where the last language initial is < 'z' · 02161ef2
      Florent Rougon authored
      FcLangSetIndex() contains code like this:
      
        low = fcLangCharSetRanges[firstChar - 'a'].begin;
        high = fcLangCharSetRanges[firstChar - 'a'].end;
        /* no matches */
        if (low > high)
      
      The assumption behind this test didn't hold before this commit, unless
      there is at least one language name that starts with 'z' (which is
      thankfully the case in our world :-). If the last language name in
      lexicographic order starts for instance with 'x', this change ensures
      that fcLangCharSetRanges['y' - 'a'].begin and
           fcLangCharSetRanges['z' - 'a'].begin
      are equal to NUM_LANG_CHAR_SET, in order to make the above assumption
      correct in all cases.
      02161ef2
  4. 05 Nov, 2013 1 commit
    • Alan Coopersmith's avatar
      Leave room for null terminators in arrays · cb72901d
      Alan Coopersmith authored
      Code currently returns a fatal error if it tries to add more entries
      than the array has room for, but it wasn't checking to make sure
      the final null terminator entry would fit.
      
      Reported by parfait 1.3:
      Error: Buffer overrun
         Buffer overflow (CWE 120): In array dereference of files[i] with index i
            Array size is 256 elements (of 4 bytes each), index >= 0 and index <= 256
              at line 250 of fc-glyphname/fc-glyphname.c in function 'main'.
      Error: Buffer overrun
         Buffer overflow (CWE 120): In array dereference of entries[i] with index i
            Array size is 1024 elements (of 8 bytes each), index >= 0 and index <= 1024
              at line 298 of fc-lang/fc-lang.c in function 'main'.
      Signed-off-by: Alan Coopersmith's avatarAlan Coopersmith <alan.coopersmith@oracle.com>
      cb72901d
  5. 03 Jan, 2013 1 commit
  6. 31 Dec, 2012 1 commit
  7. 08 Jun, 2012 1 commit
  8. 14 Mar, 2011 1 commit
  9. 10 Nov, 2010 1 commit
  10. 21 Sep, 2010 1 commit
  11. 03 Jun, 2010 1 commit
  12. 26 Aug, 2009 1 commit
  13. 24 Jun, 2009 2 commits
    • Behdad Esfahbod's avatar
      [fc-lang] Make LangSet representation in the cache files stable · ffd6668b
      Behdad Esfahbod authored
      Fontconfig assigns an index number to each language it knows about.
      The index is used to index a bit in FcLangSet language map.  The bit
      map is stored in the cache.
      
      Previously fc-lang simply sorted the list of languages and assigned
      them an index starting from zero.  Net effect is that whenever new
      orth files were added, all the FcLangSet info in the cache files would
      become invalid.  This was causing weird bugs like this one:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=490888
      
      With this commit we fix the index assigned to each language.  The index
      will be based on the order the orth files are passed to fc-lang.  As a
      result all orth files are explicitly listed in Makefile.am now, and
      new additions should be made to the end of the list.  The list is made
      to reflect the sorted list of orthographies from 2.6.0 released followed
      by new additions since.
      
      This fixes the stability problem.  Needless to say, recreating caches
      is necessary before any new orthography is recognized in existing fonts,
      but at least the existing caches are still valid and don't cause bugs
      like the above.
      ffd6668b
    • Behdad Esfahbod's avatar
      [fc-lang] Fix bug in country map generation · bb36e676
      Behdad Esfahbod authored
      Previously the county map code was using an uninitialized variable and
      hence was totally failing to populate same-lang-different-territory map.
      bb36e676
  14. 13 Mar, 2009 1 commit
  15. 02 Mar, 2009 1 commit
  16. 14 Feb, 2009 1 commit
  17. 18 Oct, 2007 1 commit
  18. 05 Sep, 2006 2 commits
  19. 01 Sep, 2006 1 commit
  20. 30 Aug, 2006 2 commits
    • Keith Packard's avatar
      Fix build problems caused by cache rework. · e3096d90
      Keith Packard authored
      Pagesize no longer matters in architecture decisions, the entire cache file
      is mmaped into the library. However, lots of intptr_t values are in use now,
      so that value is important.
      
      fc-lang now requires fcserialize.c, which has been added to the repository.
      e3096d90
    • Keith Packard's avatar
      Rework cache files to use offsets for all data structures. · 7ce19673
      Keith Packard authored
      Replace all of the bank/id pairs with simple offsets, recode several
      data structures to always use offsets inside the library to avoid
      conditional paths. Exposed data structures use pointers to hold offsets,
      setting the low bit to distinguish between offset and pointer.
      
      Use offset-based data structures for lang charset encodings; eliminates
      separate data structure format for that file.
      
      Much testing will be needed; offsets are likely not detected everywhere in
      the library yet.
      7ce19673
  21. 11 Apr, 2006 1 commit
    • Patrick Lam's avatar
      Properly convert static charsets to dynamic charsets. · 04f7d3e7
      Patrick Lam authored
      Fix memory leak in error case (Coverity defects #1820, #1821, #1822).
      Fix memory leak (Coverity defect #1819).
      prevent crash when invalid include line is parsed (Coverity defect #763).
      Fix potential null pointer access (Coverity defect #1804).
      Remove dead code (Coverity defect #1194).
      Prevent potential null pointer access (Coverity defect #767), ensure error
          value is read (Coverity defect #1195).
      reviewed by: plam
      04f7d3e7
  22. 10 Apr, 2006 1 commit
  23. 07 Apr, 2006 1 commit
  24. 06 Apr, 2006 1 commit
  25. 22 Feb, 2006 2 commits
  26. 07 Feb, 2006 1 commit
  27. 29 Nov, 2005 1 commit
  28. 19 Nov, 2005 1 commit
    • Patrick Lam's avatar
      Further fix of patch from 2005-11-04: miscounted numbers count · a151aced
      Patrick Lam authored
          (numbers_count); didn't strip duplicate numbers (langBankNumbers); and
          leafidx_offset and numbers_offset in fcLangCharSets are wrong.
      Removed leafidx_count and numbers_count since they are the same and
          replaced them with offset_count.
      reviewed by: plam
      a151aced
  29. 04 Nov, 2005 1 commit
  30. 23 Sep, 2005 1 commit
  31. 22 Sep, 2005 1 commit
    • Patrick Lam's avatar
      Fix more gcc4 warnings: · 67accef4
      Patrick Lam authored
      - Cast sizeof to int, to shut up signedness warnings in comparison.
      - Add consts where appropriate.
      reviewed by: Patrick Lam <plam@mit.edu>
      67accef4
  32. 11 Sep, 2005 1 commit
  33. 24 Aug, 2005 1 commit
    • Patrick Lam's avatar
      Overhaul the serialization system to create one mmapable file per directory · 4262e0b3
      Patrick Lam authored
          and distribute bytes for each directory from a single malloc for that
          directory. Store pointers as differences between the data pointed to
          and the pointer's address (s_off = s - v). Don't serialize data
          structures that never actually get serialized. Separate strings used
          for keys from strings used for values (in FcPatternElt and FcValue,
          respectively). Bump FC_CACHE_VERSION to 2.
      4262e0b3
  34. 25 Jul, 2005 2 commits
    • Keith Packard's avatar
      Various GCC 4 cleanups for signed vs unsigned char · 71f94d07
      Keith Packard authored
      Match only [0-9]*.conf files in <include>{directory}</include> elements to
          avoid loading *.rpmsave or .dpkg-old files. (otaylor)
      71f94d07
    • Patrick Lam's avatar
      #ifdef out old cache stuff, replace with first version of new mmapping · 212c9f43
      Patrick Lam authored
          cache. Add *Read and *Write procedures which mmap in and write out the
          fontconfig data structures to disk. Currently, create cache in /tmp,
          with different sections for each architecture (as returned by uname's
          .machine field. Run the fc-cache binary to create a new cache file;
          fontconfig then uses this cache file on subsequent runs, saving lots of
          memory. Also fixes a few bugs and leaks.
      212c9f43
  35. 28 Jun, 2005 1 commit
    • Patrick Lam's avatar
      Add functionality to allow fontconfig data structure serialization. · cd2ec1a9
      Patrick Lam authored
      This patch allows the fundamental fontconfig data structures to be
          serialized. I've converted everything from FcPattern down to be able to
          use *Ptr objects, which can be either static or dynamic (using a union
          which either contains a pointer or an index) and replaced storage of
          pointers in the heap with the appropriate *Ptr object. I then changed
          all writes of pointers to the heap with a *CreateDynamic call, which
          creates a dynamic Ptr object pointing to the same object as before.
          This way, the fundamental fontconfig semantics should be unchanged; I
          did not have to change external signatures this way, although I did
          change some internal signatures. When given a *Ptr object, just run *U
          to get back to a normal pointer; it gives the right answer regardless
          of whether we're using static or dynamic storage.
      I've also implemented a Fc*Serialize call. Calling FcFontSetSerialize
          converts the dynamic FcFontSets contained in the config object to
          static FcFontSets and also converts its dependencies (e.g. everything
          you'd need to write to disk) to static objects. Note that you have to
          call Fc*PrepareSerialize first; this call will count the number of
          objects that actually needs to be allocated, so that we can avoid
          realloc. The Fc*Serialize calls then check the static pointers for
          nullness, and allocate the buffers if necessary. I've tested the
          execution of fc-list and fc-match after Fc*Serialize and they appear to
          work the same way.
      cd2ec1a9