Commit Graph

5612 Commits

Author SHA1 Message Date
Florent Rougon
bb23af5d38 ResourceManager::findPath(): validate; accept absolute, read-allowed paths
- Perform the SGPath::validate() test for read access before returning a
  path obtained with a non-null second argument ("aContext").

- If SGPath(aContext, aResource) is an absolute path for which read
  access is authorized by SGPath::validate(), return it. This restores
  the possibility of using the 'play-audio-sample' FGCommand with an
  absolute, read-allowed path (was lost in FG commit 8853fded2953959).

- Because a fair number of the existing uses of
  ResourceManager::findPath() are not quite correct IMO, we execute the
  final part where all providers are tried in turn even if
  SGPath(aContext, aResource) is an absolute path (otherwise, the sim
  wouldn't start because it couldn't load materials.xml---see [1]).

- The SG_LOG call will spot a few errors in calling code/data, such as
  access tried for
  '/Aircraft/Generic/flightrecorder/generic-piston-propeller-4.xml' and
  '/Textures/Sky/cl_cumulus2.png'; since the function does not return at
  this point, these incorrect absolute paths which should be relative
  will still be given a chance with the BasePathProvider that has its
  base path set to $FG_ROOT; thus, they will be found as before this
  commit despite the new "access refused" warning (but please fix
  them!).

This commit requires FlightGear commit e7594f46876fc6b0b.

[1] https://sourceforge.net/p/flightgear/mailman/message/37697516/
2022-09-21 10:08:20 +03:00
Florent Rougon
7174cef8f4 SGPath: make read_allowed_paths and write_allowed_paths static data members
No functional change, only a tidier organization.
2022-09-21 10:07:23 +03:00
Florent Rougon
c464a405b5 Import FlightGear's fgValidatePath() as SGPath::validate()
This will allow us to perform access control validation in SimGear. The
current implementation of SGPath::validate() is 99% Rebecca Palmer's
work (see fgValidatePath() in FlightGear commit
6a30e7086ea2f1a060dd77dab6e7e8a15b43e82d); only the coding style has
been slightly modernized here since we can now use, for instance,
C++11's range-based for loop.
2022-09-21 10:07:23 +03:00
Florent Rougon
198ca0f18b SGPath: rename validate() to updateAttrsIfNull()
This is to avoid confusion because the following commit will make
SGPath::validate(bool) replace the fgValidatePath() function from the
FlightGear repository.
2022-09-21 10:07:23 +03:00
Florent Rougon
9482844f3b SGSoundSample constructor changes
- Add an explicit constructor SGSoundSample(const SGPath& file) that
  directly uses the specified path instead of going through
  ResourceManager::findPath().

- Reimplement the existing constructor as
  SGSoundSample(const std::string& file, const SGPath& dir),
  delegating to the new one.

- The first argument of the delegating constructor is now a
  const std::string& instead of a const char*.

Among others, this will allow a better implementation of
FGSoundManager::playAudioSampleCommand(). More explanations can be found
here:

  https://sourceforge.net/p/flightgear/mailman/message/37695786/
2022-09-21 10:07:23 +03:00
James Turner
b30d58b7df XML submodel: log the model name in the error.
Try to improve diagnosis of problems where overlay XML Nodes are used,
and the model path might be empty, as happened with the 737-800
2022-09-16 10:27:18 +02:00
James Turner
03cf345e46 DNSClient: reorder timeout check
Check completion before timeout, so that complete requests which have
also exceeded their timeout don’t crash
2022-09-16 10:04:29 +02:00
Erik Hofman
a333f58564 Jean-Paul Acneaux (www2):
Update the world magnetic model data set from WMM2015 to WMM2020.
2022-09-16 10:04:09 +02:00
James Turner
9b804a4688 METAR parsing: parse more cloud covers
Parse cloud coverage with no coverage or height
SF-ID: https://sourceforge.net/p/flightgear/codetickets/2750/
2022-07-01 16:29:05 +02:00
James Turner
6330fa4657 Allow specifing TerraSync DNS nameserver 2022-07-01 16:26:53 +02:00
Stuart Buchanan
453d19c496 Fix rotation of cloud sprites (#2359)
Previously 3D cloud re-position code did not re-orientate
the sprites, leading to the sprites being at an angle for
long flights.

Fix from Michael DANILOV to address this.
2022-04-11 15:25:54 +02:00
Automatic Release Builder
41bd7dbfcd new version: 2020.3.14 2022-04-04 11:41:23 +01:00
Richard Harrison
62216e1e23 DDS-TC: Add origin to CanvasImage loadImage
Method loadImage should set the canvas origin to allow the DDS texture cache to act appropriately (i.e. not include anything from Canvas)
2022-04-04 11:41:23 +01:00
Richard Harrison
6685143d70 DDS-TC : Always exclude all of canvas origin
The assumption is that all images coming from Canvas should be excluded from inclusion into the DDS texture cache.

Previously there was special logic that only excluded transparent images of Canvas origin but this was probably wrong.
2022-04-04 11:41:23 +01:00
James Turner
711cc512c5 Effects: pass the model XML path through to makeEffects
This gives knowledge of how to resolve relative paths, to makeEffects
invocation of findDataFile, and hence gives a more familiar lookup
ordering, for Aircraft-supplied effects.

SF-ID: https://sourceforge.net/p/flightgear/codetickets/2678/
2022-02-27 16:37:32 +00:00
James Turner
d0dee701a9 Error reports: default to SG_LOG(SG_ALERT
When no callback is registered, just fall back to a plain SG_ALERT
2022-02-20 16:43:10 +02:00
Fahim Imaduddin Dalvi
e87a671942 WS20: Object mask bug fix for random lights
The random lights placement algorithm was using the incorrect channel
from the object mask image, (red instead of blue as mentioned in
Docs/README.materials). This commit rectifies the mismatch.
2022-02-06 11:08:56 +00:00
Automatic Release Builder
234abdf85c new version: 2020.3.13 2022-02-03 13:10:02 +00:00
Automatic Release Builder
e5bef3f97f Extend simgear::Optional with value_or
Needed to allow parity with C++17 use on next
2022-02-03 12:52:58 +00:00
Jonathan Redpath
af0f7676c4 osgText: improve code to search aircraft directory for font 2022-01-12 11:16:05 +00:00
Automatic Release Builder
a3bdfab17b new version: 2020.3.12 2021-12-20 16:19:27 +00:00
Fernando García Liñán
44bae773a0 Canvas: Set pointers to NULL instead of calling .release()
The Canvas camera and texture get recreated in several circumstances.
Calling .release() on a ref_ptr will just return the raw pointer and
'delete' won't be called. The proper way to explicitly delete an object
managed by a ref_ptr is to set the ref_ptr to NULL. This will delete it
as long as it's not referenced by any other ref_ptr.
2021-12-20 16:12:06 +00:00
James Turner
5fe527a2d1 MaterialLib: make it thread-safe 2021-12-20 16:10:31 +00:00
James Turner
b79f03c96c Fix a ref-count loop in Paticles manager 2021-12-20 16:10:31 +00:00
Erik Hofman
631fa62495 Michael Danilov: Fix issue #2169 Sound with condition=false will play when moving into its max-dist (patch available) 2021-09-25 11:17:15 +02:00
Automatic Release Builder
a157e50302 Ooops, use correct variable name. 2021-07-29 10:21:20 +01:00
Automatic Release Builder
70e6b6b13f new version: 2020.3.11 2021-07-29 09:08:37 +01:00
James Turner
c457561472 HTTPRepo: Add detail to an error
This is showing up in the wild, but not clear how, so extend the
logging.
2021-07-29 08:47:12 +01:00
James Turner
2b5ac6350d remove an error on stable, too common. 2021-07-28 15:14:41 +01:00
James Turner
1c30b29168 Report errors on TileDetails callback failures
This callback can do out of memory and other failures, so catch
those and report them.
2021-07-28 15:14:41 +01:00
James Turner
ce9f476ddb Don't report PropsIO exceptions 2021-07-28 14:23:38 +01:00
James Turner
2621418d3a Fix a dumb back-port issue. 2021-07-22 10:11:04 +01:00
James Turner
174b341bef Don’t report HTTPRepo removeChild failures
Sentry-Id: FLIGHTGEAR-E5T
2021-07-15 10:31:28 +01:00
James Turner
df33713069 Remove incorrectly added ‘version’ file 2021-07-15 08:44:08 +01:00
James Turner
cde75530fe BTG reading: don’t crash on empty error message
Sentry-Id:FLIGHTGEAR-WA8
2021-07-15 08:43:31 +01:00
Automatic Release Builder
a9dddbcddc new version: 2020.3.10 2021-07-06 10:56:20 +01:00
James Turner
fcd72581a1 Make out-of-memory in computeHash fatal 2021-07-06 02:53:28 +01:00
James Turner
0a6091eeeb Error reporting for animations / conditions
Don’t report errors for each condition parse failure, but do 
aggregate them at the animation level in ReaderWriterXML

Sentry-Id: FLIGHTGEAR-DD
2021-07-06 02:50:11 +01:00
James Turner
d6400e3737 Add try/catch wrappers in SGSubsystemGroup
Attempt to narrow down the source of some fatal exceptions we see
on Senty, which occur during init/startup. All these blocks re-throw
so user behaviour is unchanged, but we’ll log the name of the subsytem.
2021-07-06 02:49:51 +01:00
James Turner
71e7050349 Attempt to fix realpath() recursion
Sentry-Id: FLIGHTGEAR-D6W
2021-06-15 17:31:33 +01:00
Automatic Release Builder
e6f4936536 better STG error reporting 2021-06-15 02:33:31 +01:00
Automatic Release Builder
b2ae7e9e63 Fix initial effect errors 2021-06-15 02:33:20 +01:00
Automatic Release Builder
ee0b22fd52 Fix HTTP repo erros 2021-06-15 02:33:11 +01:00
James Turner
01233ba537 Error-reporting: improve reports for STGs and effects
When an effect defines no shader sources, special case this error to
avoid confusing result from SGProgram.

Add error-context for readNode STG loading, so failures inside an
STG can be attributed
2021-06-14 20:01:30 +01:00
James Turner
ed29d9b75d Effects: better error reporting 2021-06-14 20:00:04 +01:00
James Turner
5d4201cdfa Shaders: report all shader file paths
When reporting a shader log error, include all the shader file
paths and the effect path in the detailed error information.
2021-06-14 19:59:36 +01:00
James Turner
2ef8c0d27b ReadWav: error reporting
Report errors from readWAV, and improve attribution for the
format error (include the file path). As a result, mark the individual
exceptions as dont-report, since we will report higher up.
2021-06-14 19:58:42 +01:00
James Turner
0fbfa3426f Catalogs: check for local IO failures writing to disk
Sentry.io shows some examples where we failed to write valid data
to disk; check for that if possible.
2021-06-14 19:58:18 +01:00
James Turner
57b4060eb3 Error-reporting: show XML path when 3D load fails 2021-06-14 19:57:16 +01:00
James Turner
84a569913d Report out-of-memory in some loading places
BTG can throw bad-alloc in the wild; catch this case and report it.
2021-06-14 19:56:53 +01:00