I have used sand in a garbage bag many times before to measure cavities into which I wish to build speaker enclosures. In the case of audio work, getting really close was good enough, but if you just want a 98% estimate, use sand.
In some cases, I just put the bag in the cavity and fill it with sand. For more progressive curves and cavities that does the trick. If you have oddly convoluted shapes, what I suggest is using a light-duty "repositionable" spray adhesive on the bag. Then you can poke it into odd shapes and have it hold in place. If you don't, you can't be assured that the bag is fully displacing.
To add accuracy, I will use an air hammer with a custom-made flat anvil to settle the sand, then after I pour the sand in a measuring vessel I use the air hammer again to make sure its leveled out similarly.
Perfect? no. Super close? yes.