Is there a hardware or software limitation to how long smartphone can record video?
In theory no limit on recording. But as you say overheading is a big problem on summar days.

I experience that camera did shutted down recording video because a software problem. When you recorded, everyframe have to processed by processor. And camera recording process is a stream between processor and camera chip. During this stream, if a bit of stream's data changes, processor will handle an error in stream and will delete all recorded stream. This is a one scenario. Scenario's count can be increased. 

For example if processor heat up, and after heating up , on transistor level will one electricity jump 1001st transistor to 1002th transistor and this cause a processor error and this can be the limit of recording video. 

I hope I could explain.