Stocks have rocketed higher recently, erasing most of the massive losses seen during the coronavirus market crash earlier this year. In fact, the S&P 500 is actually up about 5% year to date. While this bull market resurgence has been good for investors' portfolios, there's always a possibility of another market crash around the corner.

Indeed, many investors may have some specific concerns on their mind, including uncertainties surrounding the election, the possibility of a bigger wave of COVID-19 cases during the cold and flu season, increasing national debt levels, or simply a stock market correction after a sharp run higher. Any of these factors has the potential to morph into a bearish trigger for the market, potentially leading to a stock market crash.

If you are concerned about a potential market crash and want to invest in companies that can easily endure extended periods of economic weakness, consider investing in these two stocks: Warren Buffett's Berkshire Hathaway (BRK.B 0.73%) (BRK.A 0.59%) and grocery chain Kroger (KO 0.79%).

A chart showing a stock price falling

Image source: Getty Images.

2 stocks for a market crash

Berkshire Hathaway, helmed by famed investor Warren Buffett, is a financial fortress built to endure just about anything that is thrown its way. Buffett has said Berkshire's financial affairs will always be managed "in a manner allowing the company to withstand external shocks of an extreme nature." Perhaps this explains the company's record $143 billion cash and cash equivalents at the end of its most recent quarter. This war chest is equal to about 28% of Berkshire Hathaway's $511 billion market cap at the time of this writing.

Even more, many of Berkshire's assets and stock holdings are defensive companies selling products likely to continue to be purchased during tough times. A significant portion of Berkshire's operating activities, for instance, are made up of its insurance business -- from its reinsurance companies like General Re and its auto insurance subsidiary Geico; insurance is a necessary product in any market. Other notable resilient Berkshire assets include its 9% and 27% stakes in Coca-Cola and Kraft Heinz, respectively, and wholly owned subsidiaries Duracell, Nebraska Furniture Mart, International Dairy Queen.

Kroger's business similarly has characteristics of an enduring asset. The country's dependence on grocery stores like Kroger earlier this year when many stores were shut down amid stay-at-home orders put the importance of Kroger's business in the limelight. The company's stores were deemed an essential business and consumers flocked to the stores to buy staple items and affordable food.

While an influx of business unsurprisingly resulted from consumers sheltering at home earlier this year, Kroger was already doing well before these unusual circumstances. In 2019, same-store sales were up 2% year over year and management had guided for an acceleration in this key metric in 2020.

There are no guarantees in investing

Though both Berkshire Hathaway and Kroger look better positioned than most companies to endure another recession, this doesn't mean their stocks wouldn't fall along with broader market indices during a market crash. But if the market does get slammed, Berkshire and Kroger's recession-resilient businesses may help their stocks fall less than the overall market during a downturn. Further, the two stocks' underlying businesses may suffer less than those who are more dependent on a thriving economy.

Of course, investors should bear in mind that it's impossible to time the market. So it wouldn't be wise to load up on these two companies' stocks in anticipation of a market crash. The economy is difficult to predict -- a stock market even more so. However, if you do have concerns about a market crash but are still looking to invest some money, putting a portion of your capital in these two stocks could help you play better defense.