patch_big_files.diff 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. diff --git a/thirdparty/libbacktrace/read.c b/thirdparty/libbacktrace/read.c
  2. index 1811c8d2e0..fda8e222d4 100644
  3. --- a/thirdparty/libbacktrace/read.c
  4. +++ b/thirdparty/libbacktrace/read.c
  5. @@ -52,14 +52,9 @@ backtrace_get_view (struct backtrace_state *state, int descriptor,
  6. {
  7. uint64_t got;
  8. ssize_t r;
  9. -
  10. - if ((uint64_t) (size_t) size != size)
  11. - {
  12. - error_callback (data, "file size too large", 0);
  13. - return 0;
  14. - }
  15. -
  16. - if (lseek (descriptor, offset, SEEK_SET) < 0)
  17. +/* GODOT start */
  18. + if (_lseeki64 (descriptor, offset, SEEK_SET) < 0)
  19. +/* GODOT end */
  20. {
  21. error_callback (data, "lseek", errno);
  22. return 0;
  23. @@ -74,7 +69,13 @@ backtrace_get_view (struct backtrace_state *state, int descriptor,
  24. got = 0;
  25. while (got < size)
  26. {
  27. - r = read (descriptor, view->base, size - got);
  28. +/* GODOT start */
  29. + uint64_t sz = size - got;
  30. + if (sz > INT_MAX) {
  31. + sz = INT_MAX;
  32. + }
  33. + r = _read (descriptor, view->base, sz);
  34. +/* GODOT end */
  35. if (r < 0)
  36. {
  37. error_callback (data, "read", errno);
  38. @@ -84,6 +85,9 @@ backtrace_get_view (struct backtrace_state *state, int descriptor,
  39. if (r == 0)
  40. break;
  41. got += (uint64_t) r;
  42. +/* GODOT start */
  43. + view->base += r;
  44. +/* GODOT end */
  45. }
  46. if (got < size)