mcneel / compute.rhino3d

REST geometry server based on RhinoCommon and headless Rhino
Other
301 stars 188 forks source link

DataCache regards base64-encoded data as url and crashes #655

Open hstehling opened 8 months ago

hstehling commented 8 months ago

I am using a custom plug-in that receives a custom data type as a parameter. This datatype contains GeometryBase instances (in this case: Meshes). Simplified example:

{
  "type": "MyDataType",
  "objects": [
    {
      "type": "MyOtherType",
      "geometry": "Base64-encoded Mesh"
    }
  ]
}

Now I came across a certain data set that produces a crash, and I tracked it down to this line in DataCache.cs:

https://github.com/mcneel/compute.rhino3d/blob/d34dfa14161aaeb43f0692505dccf7ad30bc84c8/src/compute.geometry/DataCache.cs#L210

Turns out that the Base64-encoded data coincidentially contains both urL and hTtP which makes the DataCache believe it found something. 🤯

Can this condition be defined more narrow in order to prevent such a false positive? I am not sure for what it is used or how the expected data structure looks.