cherry-pick.FILE5_25-6-gb72c33f.remove-over-zealous-and-fix-test-properly.patch 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. Subject: remove over-zealous, and fix test properly
  2. Origin: FILE5_25-6-gb72c33f
  3. Upstream-Author: Christos Zoulas <christos@zoulas.com>
  4. Date: Wed Sep 16 22:37:05 2015 +0000
  5. --- a/src/softmagic.c
  6. +++ b/src/softmagic.c
  7. @@ -1098,12 +1098,6 @@
  8. mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
  9. const unsigned char *s, uint32_t offset, size_t nbytes, struct magic *m)
  10. {
  11. - if (offset >= nbytes) {
  12. - file_magerror(ms,
  13. - "offset in magic %u greater than buffer size %zu",
  14. - offset, nbytes);
  15. - return -1;
  16. - }
  17. /*
  18. * Note: FILE_SEARCH and FILE_REGEX do not actually copy
  19. * anything, but setup pointers into the source
  20. @@ -1268,7 +1262,7 @@
  21. if (m->in_op & FILE_OPINDIRECT) {
  22. const union VALUETYPE *q = CAST(const union VALUETYPE *,
  23. ((const void *)(s + offset + off)));
  24. - if (OFFSET_OOB(offset + off, nbytes, sizeof(*q)))
  25. + if (OFFSET_OOB(nbytes, offset + off, sizeof(*q)))
  26. return 0;
  27. switch (cvt_flip(m->in_type, flip)) {
  28. case FILE_BYTE:
  29. @@ -2166,7 +2160,6 @@
  30. private int
  31. handle_annotation(struct magic_set *ms, struct magic *m)
  32. {
  33. -printf("desc = %s, ext = %s mime = %s\n", m->desc, m->ext, m->mimetype);
  34. if (ms->flags & MAGIC_APPLE) {
  35. if (file_printf(ms, "%.8s", m->apple) == -1)
  36. return -1;